I am arranging multiple plot using the patchwork package. One of the plots has the text arranged vertically, which pushes the x-axis label down (as it should), but when I combine with a second plot, the x-axis labels in both plots are moved down. I would like to keep the x-axis label of the second plot in its original position. Easier to explain with an example:
library(ggplot2)
library(patchwork)
# Toy data
mtcars2 <- mtcars[1:5, ]
mtcars2$mod <- row.names(mtcars2)
# make 2 plots
p1 <- ggplot(mtcars2, aes(mod, mpg)) +
geom_col() +
theme(axis.text.x = element_text(angle = 90, vjust = 0, hjust = 1))
p2 <- ggplot(mtcars2, aes(hp, disp)) +
geom_point()
# arrange plots next to each other
p1 + p2
But I want:
Is this possible? I'm not tied to patchwork and I tried gridExtra::grid.arrange() but that resized the plots instead.


