【问题标题】:Better solution regarding annotation in ggplot?关于 ggplot 中的注释的更好解决方案?
【发布时间】:2014-05-15 04:21:37
【问题描述】:

我有以下代码

     standard_text = "(%)"
    plotmath_text <- "I^2"
    g <- ggplot(data=data.frame(x=0,y=0))+geom_point(aes(x=x,y=y))
g+ annotate("text", x = 4.3, y = 6.97, label =standard_text)+
 annotate("text",x = 4, y = 7, cex = 7, label = plotmath_text,parse = TRUE )

生成一个图形,其右上角有注释

I^2 (%)

有什么方法可以只使用 annotate 命令而不是两个来创建相同的注释?我试图将它们合并到that page 之后的一个命令中,但我总是遇到错误。

【问题讨论】:

    标签: r ggplot2 plotmath


    【解决方案1】:
    annotate("text", x = 4, y = 7, cex = 7, label = "I^2 ~ ('%')", parse = TRUE)
    

    UPD:相关问题:onetwo

    【讨论】:

      猜你喜欢
      • 2020-02-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-07-20
      • 2011-11-21
      • 1970-01-01
      相关资源
      最近更新 更多