【发布时间】:2019-09-30 01:06:46
【问题描述】:
我正在使用ggarrange 和annotate_figure 并排显示两个图。在我的实际代码中,我在每个子图上都有不同的标题,但是在整个图的顶部需要一个共同的标题和副标题。
我了解如何在顶部添加文本,但是如何添加两行,每行具有不同的字体(例如,顶部标题应该是大/粗体,第二行/副标题应该是较小的常规字体)?
这是我制作标题的方式。有没有办法将text_grob 添加到top?
library(tidyverse)
library(ggpubr)
df <- data.frame()
plot1 <- ggplot(df) + geom_point() + xlim(0, 10) + ylim(0, 100)
plot2 <- ggplot(df) + geom_point() + xlim(0, 10) + ylim(0, 100)
all.plots <- ggarrange(plot1, plot2)
annotate_figure(all.plots,
top=text_grob("Antibiotic Effectiveness"))
【问题讨论】:
-
我通常为此使用cowplot stackoverflow.com/questions/50973713/…
-
我在了解如何为此使用 cowplot 时遇到问题。
-
任何进一步的指导将不胜感激。
标签: r ggplot2 gridextra ggpubr