我正在使用优秀的 theme_minimal()
在白色背景的 ggplot0.9.3 中找到。我想将我的情节的标题放在情节右上角的自定义位置。在下面的例子中,我知道 x
和 y
值,但我想知道是否有办法通过 xmax
和 ymax
值以确保文本放置在右上角。理想情况下,文本应正确对齐。
#example plot
p <- qplot(mpg, wt, data = mtcars, colour = cyl)
p + annotate("text", x = 30, y = 5, label = "Custom Title")
#what I would like
p + annotate("text", y= ymax, x =xmax_or_RightJustified)
最佳答案
你可以做
p + annotate("text", x=Inf, y = Inf, label = "Some text", vjust=1, hjust=1)
关于r - 将 ggplot 标题定位在图的右上角,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14928711/