[英]How to make several plots on the same page in R using cowplot package?
I am using built-in data set iris in R, I want to plot several graphs on the same page for which I am using cowplot package. 我在R中使用内置数据集虹膜,我想在同一页面上绘制一些图形,而我正在使用Cowplot程序包。
However, the problem I face is that the labels in the figures i,e "A" and "B" overlap the y-axix. 但是,我面临的问题是图中的标签“ A”和“ B”与y轴重叠。 How can I lleave some space in between labels and y-axis? 如何在标签和y轴之间留出一些空间? My code is: 我的代码是:
View(iris)
library(tidyverse)
p1 <- ggplot(iris, aes(Sepal.Length, Petal.Length, col = Species))+geom_point()
p2 <- ggplot(iris, aes(Sepal.Length, Petal.Width, col = Species))+geom_point()
library(cowplot)
plot_grid(p1,p2, labels = c("(A)","(B)"))
You can try to work with the options of plot_grid
, the default are these: 您可以尝试使用plot_grid
的选项,默认选项是:
plot_grid(p1,p2, labels = c("(A)","(B)"), align = 'h', label_size = 12,
label_x = 0, label_y = 1, hjust = -0.5, vjust = 1.5 )
For example, something like this: 例如,如下所示:
plot_grid(p1,p2, labels = c("(A)","(B)"), align = 'h', label_size = 12,
label_x = 0, label_y = 1, hjust = -0.1, vjust = 5 )
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.