Reputation: 107
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.
However, the problem I face is that the labels in the figures i,e "A" and "B" overlap the y-axix. How can I lleave some space in between labels and y-axis?
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)"))
Upvotes: 0
Views: 515
Reputation: 9485
You can try to work with the options of plot_grid
, the default are these:
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 )
Upvotes: 1