patchwork icon indicating copy to clipboard operation
patchwork copied to clipboard

justification of axis titles when angles differ

Open fawda123 opened this issue 4 years ago • 0 comments

Hi there, I absolutely love patchwork, thanks for the great package.

I'm wondering if there's a way to justify axis titles when the angles differ. In the example below, it would be great if the x axis title on the first plot could justified to the top, instead of where it's at far below the axis. Is this possible? I tried playing around with vjust for axis.title.x for the first plot, but no luck.

library(ggplot2)
library(patchwork)

p1 <- ggplot(mtcars) + geom_point(aes(mpg, disp))
p2 <- ggplot(mtcars) + geom_boxplot(aes(gear, disp, group = gear)) + 
  theme(axis.title.x = element_text(angle = 90, vjust = 0.5)) + 
  labs(x = 'really long axis title that pushes the first very low')

p1 + p2

image

fawda123 avatar Aug 16 '21 17:08 fawda123