Packages like cowplot and pathwork allow different plots to be aligned next/on each other with the plot-area dimensions synchronized, regardless of the space required by axis labels. e.g.
install.packages("ggridges")
install.packages("patchwork")
library(tidyverse)
library(ggridges)
library(patchwork)
p1 <- ggplot(iris, aes(Sepal.Length, Species)) +
geom_density_ridges()
p2 <- ggplot(mtcars) +
geom_point(aes(mpg, disp))
p1 + p2 + plot_layout(ncol=1) #different length of y axis label, same plot area size.
This is all good for html display. However, for journals, I and many others need to produce "stand-alone" plots. The graphs display data from different sources and have different axis label length. For a professional appearance, these plots also need to have the same plot-size. In article format, they will often appear if the same formatted page but with text between them, and
So, how do I make they need to be completely "aligned" (as in example above) but as SEPARATE r objects, so to speak.
How can I achieve this?
ggsave(plot = x, filename = 'x.pdf', width = ..., height = ...)
. will result in very similar axis lengths, but not exactly the same. If the objects are spread over several pages, this is likely not going to be noticeable, so this would be the easiest option. – tjebo