I'm using par(mfrow = c(1, 2))
to plot my graphs, but I was wondering if is another way to do it, I'm asking this cause I tried to find the mfrow function in R for data science book and I didn't find it...
CodePudding user response:
Here are several methods to achieve it:
- by plot_grid in cowplot
cowplot::plot_grid( p1, p2, labels = c("A", "B") )
- by patchwork
library(patchwork) p1 p2 plot_annotation( tag_levels = "A", title = "The surprising truth about mtcars", subtitle = "These 3 plots will reveal yet-untold secrets about our beloved data-set", caption = "Disclaimer: None of these plots are insightful")
p1 and p2 are the two plots.