我正在使用 ggplot2来改进降水量标记。
这里有一个我想实现的可复制的例子:
library(ggplot2)
library(gridExtra)
secu <- seq(1, 16, by=2)
melt.d <- data.frame(y=secu, x=LETTERS[1:8])
m <- ggplot(melt.d, aes(x=x, y=y)) +
geom_bar(fill="darkblue") +
labs(x="Weather stations", y="Accumulated Rainfall [mm]") +
opts(axis.text.x=theme_text(angle=-45, hjust=0, vjust=1),
title=expression("Rainfall"), plot.margin = unit(c(1.5, 1, 1, 1), "cm"),
plot.title = theme_text(size = 25, face = "bold", colour = "black", vjust = 5))
z <- arrangeGrob(m, sub = textGrob("Location", x = 0, hjust = -3.5, vjust = -33, gp = gpar(fontsize = 18, col = "gray40"))) #Or guessing x and y with just option
z
我不知道如何避免在 hjust 和 vjust 上使用猜测数字在 ggplot2上?有没有更好的方法来放置字幕(不仅仅是使用 n,而是使用不同文本颜色和大小的字幕) ?
我需要能够使用的 ggsave 有一个 pdf 文件。
这里有两个相关的问题:
谢谢你的帮助。