相关疑难解决方法(0)

如何使用latex来注释()ggplot

我想将乳胶文本添加到ggplot2图中annotate().使用expression(),描述在这里添加乳胶轴标签,似乎并没有工作.以机智:

# Use expression() to create subscripted text
p <- ggplot(mpg, aes(x=cty, y=hwy)) + geom_point() +
  scale_x_continuous(expression(text[subscript])) 

# But expression() in annotate adds nothing to the plot
p + annotate("text", x=10, y=40, label=expression(text[subscript])) 

# Passing regular text to annotate works fine
p + annotate("text", x=10, y=40, label="foo") 
Run Code Online (Sandbox Code Playgroud)

为什么expressions的处理方式annotate与其他ggplot函数不同?我怎样才能用乳胶注释?

r ggplot2

32
推荐指数
3
解决办法
2万
查看次数

标签 统计

ggplot2 ×1

r ×1