基本上,我想在下面的图表中记录我的发现,比如“在2000到2006年间,病例增加了28%。”
我尝试过使用annotation_custom,但在facet_grid的情况下,它将它放在图形上的每个方面之下,而不是完全在图形区域之外。我还尝试在SO上使用其他搜索中的网格排列,但在我能看到的任何地方都没有文本显示。
library(ggplot2)
...
graph <- ggplot(data=dataSource, aes(x=factor(year), y=Cases, fill = type))
graph <- graph+geom_bar(stat="identity")+facet_grid(.~type)
graph <- graph+labs(title="Some title here", x="Year", y="Cases by county", fill="Type")
print(graph)发布于 2016-05-30 08:37:06
在cowplot包中使用add_sub。以下是help("add_sub")的示例部分中的第一个示例:
library(ggplot2)
library(cowplot)
p1 <- ggplot(mtcars, aes(mpg, disp)) +
geom_line(colour = "blue") +
background_grid(minor='none')
ggdraw(add_sub(p1, "This is an annotation.\nAnnotations can span multiple lines."))

发布于 2016-05-30 09:24:45
我不认为grid.arrange有什么问题
gridExtra::grid.arrange(ggplot(), bottom = "annotation here")

https://stackoverflow.com/questions/37516177
复制相似问题