ggplot2
Robert Schlegel
geom_*()
we create different plotsggpubr
helps us to combine many different plotsWe will need the following three packages for the examples in these slides.
# List the names of the plot objects to combine
grid_1 <- ggarrange(lm_1, nlm_1, histogram_1, box_1,
# Set number of rows and columns
ncol = 2, nrow = 2,
# Label each figure
labels = c("a)", "b)", "c)", "d)"),
# Create common legend
common.legend = TRUE,
# Set legend position
legend = "bottom")
grid_1
# Different file types
ggsave(plot = grid_1, filename = "figures/grid_1.pdf")
ggsave(plot = grid_1, filename = "figures/grid_1.png")
ggsave(plot = grid_1, filename = "figures/grid_1.eps")
# Change dimensions
ggsave(plot = grid_1, filename = "figures/grid_1.png",
width = 10, height = 8)
# Change DPI
ggsave(plot = grid_1, filename = "figures/grid_1.png", dpi = 600)