Open BenVolpe94 opened 3 months ago
This seems to be fixed with the dev version of patchwork - have you tried with that?
Can confirm that the code works fine using the dev version of patchwork:
library(tidyverse)
library(patchwork)
packageVersion("ggplot2")
#> [1] '3.5.1.9000'
packageVersion("patchwork")
#> [1] '1.2.0.9000'
library(ggplot2)
library(patchwork)
# Create plots
p1 <- ggplot(mtcars) +
geom_point(aes(mpg, disp)) +
ggtitle('Plot 1')
p2 <- ggplot(mtcars) +
geom_boxplot(aes(gear, disp, group = gear)) +
ggtitle('Plot 2')
p3 <- ggplot(mtcars) +
geom_point(aes(hp, wt, colour = mpg)) +
ggtitle('Plot 3')
p4 <- ggplot(mtcars) +
geom_bar(aes(gear)) +
facet_wrap(~cyl) +
ggtitle('Plot 4')
# Combine plots
p1 + p2 + p3 + p4 +
plot_layout(guides = 'collect')
Created on 2024-09-08 with reprex v2.1.1
Hi! I'm currently using the latest github version of ggplot2 because it has a fix for an issue I encountered. I noticed however that this version broke the
guides = 'collect'
option in patchwork.See example below:
I get the following Traceback: