【问题标题】:Label each plot using ggpubr - R使用 ggpubr - R 标记每个图
【发布时间】:2020-10-20 13:42:33
【问题描述】:

我使用 ggarange 将一组 R 图排列成一个,如何在每个子图的左上方将它们标记为 A、B 和 C?

代码:

library(ggplot2)
library(ggpubr)


# default ggplot2 theme
P1 <- ggplot(iris, aes(Sepal.Length, Petal.Width, color = Species)) + 
  geom_point()

P2 <- ggplot(iris, aes(Sepal.Length, Sepal.Width, color = Species)) + 
  geom_point()

P3 <- ggplot(iris, aes(Petal.Length, Sepal.Width, color = Species)) + 
  geom_point()
 

ggarrange(P1, P2, P3,  ncol=3, nrow=1, common.legend = TRUE, legend="bottom")
          

【问题讨论】:

    标签: r ggplot2 ggpubr


    【解决方案1】:

    使用标签

    ggarrange(P1, P2, P3,  labels = c("A", "B", "C"),
              ncol = 3, nrow = 1, 
              common.legend = TRUE, legend = "bottom")
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-08-01
      • 2019-12-16
      • 2018-01-17
      • 2019-10-01
      • 2012-11-09
      • 2016-03-18
      • 2021-08-07
      • 1970-01-01
      相关资源
      最近更新 更多