【发布时间】:2012-09-20 14:17:54
【问题描述】:
我想使用annotate() 将乳胶文本添加到 ggplot2 图中。使用expression(),如here 所述将乳胶添加到轴标签,似乎不起作用。也就是说:
# 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")
为什么expressions 对annotate 的处理与其他ggplot 函数不同?以及如何使用乳胶进行注释?
【问题讨论】:
-
你可以看看
tikzDevice包... -
似乎不再积极维护。 (但仍然可能有用!)
-
我的理解是,它仍然被广泛使用,并且功能强大,但由于更严格的 CRAN/R CMD 检查规则,目前处于孤儿院状态......它最后一次修改是在 7 月 15 日的 R-forge 2012 ...