patchwork
patchwork copied to clipboard
axis_titles = "collect" does not work when modifying panel grid
axis_titles = "collect" does not work when modifying panel grid
For example when adding theme(panel.grid.major.x = element_blank())
Could you provide a reproducible example? I tried to replicate your issue, but I wasn't able to do so. In the simple example below, for example, the axis titles are still collected even after the grid lines have been removed from one plot.
library(ggplot2)
library(patchwork)
packageVersion("ggplot2")
#> [1] '4.0.1'
packageVersion("patchwork")
#> [1] '1.3.2'
p1 <- ggplot(mtcars) +
geom_bar(aes(gear)) +
theme(panel.grid.major.x = element_blank())
p2 <- ggplot(mtcars) +
geom_boxplot(aes(gear, disp, group = gear))
p1 + p2 +
plot_layout(axis_titles = "collect")

Created on 2025-11-29 with reprex v2.1.1
Your example indeed works. I can't quite figure out why in my code it is not working. I will keep trying to make a reproducible example.