I have two plots, which have good proportions of the plot itself and the text of the x-axis. [enter image description here][1] and [enter image description here][2]
However, when I combine them into one plot using plot_grid function, the text of the x-axis take a much larger proportion of the combined plot. [enter image description here][3]
How can I combine the plots while saving or controlling the proportions of the x-axis versus the plots themselves WITHOUT making the text smaller?
Here is my code:
ggplot(variance_birds, aes(x=reorder(Species, order), precentage)) +
geom_point(aes(shape=type), colour = 'black', size = 3, stroke = 1.5) +
theme(axis.text.y = element_text(size = 18, colour = 'black'),
axis.text.x = element_text(size = 14, angle = 70, colour = 'black',
vjust = 0.97, hjust = 1),
axis.title.y = element_text(size = 18, colour = 'black'),
legend.title = element_blank(), legend.position = "none",
legend.text = element_text(size=15),
panel.background = element_rect(fill = 'white', colour = 'black'),
panel.border = element_rect(colour = "black", fill=NA, size=.5))+
scale_shape_manual("", values=c("mean"=20,
"mean_range"=17))+
scale_y_continuous(breaks=c(0, 10, 20, 40, 60, 80, 100), limits = c(0, 100))+
geom_segment(aes(x=Species,xend=Species, y=min,yend=max),inherit.aes=FALSE,
linetype="longdash", color="black", size=0.55)+
labs(x=NULL, y="Percentage of species-typical breeding units\nwith helpers in a population")+
theme(plot.margin=unit(c(0.5,0.5,0.5,0.5),"cm"))+
draw_label("Birds", x = 2.1, y = 100, size = 20, fontface="bold")
p_birds
##Plot mammals
p_mammals<-
ggplot(variance_mammals, aes(x=reorder(Species, order), precentage)) +
geom_point(aes(shape=type), colour = 'black', size = 3, stroke = 1.5) +
theme(axis.text.y = element_text(size = 18, colour = 'black'),
axis.text.x = element_text(size = 14, angle = 70, colour = 'black',
vjust = 0.97, hjust = 1),
axis.title.y = element_text(size = 18, colour = 'black'),
legend.title = element_blank(), legend.position = "none",
legend.text = element_text(size=15),
panel.background = element_rect(fill = 'white', colour = 'black'),
panel.border = element_rect(colour = "black", fill=NA, size=.5))+
scale_shape_manual("", values=c("mean"=20,
"mean_range"=17))+
scale_y_continuous(breaks=c(0, 10, 20, 40, 60, 80, 100), limits = c(0, 100))+
geom_segment(aes(x=Species,xend=Species, y=min,yend=max),inherit.aes=FALSE,
linetype="longdash", color="black", size=0.55)+
labs(x=NULL, y="Percentage of species-typical breeding units\nwith helpers in a population")+
theme(plot.margin=unit(c(1,1,1,1),"cm"))+
draw_label("Mammals", x = 2.9, y = 92, size = 20, fontface="bold")
p_mammals+
draw_label("'", x = 14.3, y = -30.5, angle=70, size = 20, colour="black")+
coord_cartesian(ylim = c(0, 100), clip = "off")
#combining the two plots
combined_plot<-plot_grid(p_mammals+ theme(legend.position = 'none'),
p_birds+ theme(legend.position = 'none'),
align = "h", ncol = 1, rel_heights = c(5/10, 5/10))
combined_plot```
Thanks!
[1]: https://i.stack.imgur.com/FOFn6.jpg
[2]: https://i.stack.imgur.com/sf7In.jpg
[3]: https://i.stack.imgur.com/h1s8V.jpg