patchwork icon indicating copy to clipboard operation
patchwork copied to clipboard

collecting axis titles does not work when using more complex designs

Open n-kall opened this issue 2 years ago • 2 comments

The following works:

library(ggplot2)
library(patchwork)

p1 <- ggplot(mtcars) +
  geom_point(aes(mpg, disp)) +
  labs(y = "mpg", x = "collected axis title")

p2 <- ggplot(mtcars) +
  geom_boxplot(aes(gear, disp, group = gear)) +
  labs(y = "gear", x = "collected axis title")

p1 + p2 + plot_layout(axis_titles = "collect", design = "AB")

pwork1

but changing the design leads to the axis collection no longer happening

p1 + p2 + plot_layout(axis_titles = "collect", design = "AAB")

pwrk

p1 + p2 + plot_layout(axis_titles = "collect", design = "AABB")

pwork2

n-kall avatar Jan 25 '24 12:01 n-kall

axes = "collect" and axis_titles = "collect" it also doesn't work when using coord_equal

image

image

wagnnerms97 avatar Jan 27 '24 12:01 wagnnerms97

With regards to the coord_equal() thingy, the axis/title merging does not seem to work there because the axes appear to be nested alongside panels and don't have the usual grob names.

teunbrand avatar Feb 12 '24 10:02 teunbrand