patchwork
patchwork copied to clipboard
Patchwork of patwchrok does not handle properly legends
It seems to me that this was working before. I am using patchwork 1.3.0 , with ggplot2 3.5.2.
Here is my problem:
p1 <- ggplot(iris,aes(Sepal.Length,Sepal.Width,color = Species))+
geom_point()
first_plot <- p1 + inset_element(p1, right = 0.5,left = -.2,
bottom = .55,top = 1) +
plot_layout(guides = "collect") +
plot_annotation(title = "plouf")
p2 <- ggplot(iris,aes(Sepal.Length,Sepal.Width,color = Petal.Width))+
geom_point()
second_plot <- p2 + inset_element(p2, right = 0.5,left = -.2,
bottom = .55,top = 1) +
plot_layout(guides = "collect") +
plot_annotation(title = "plouf")
But:
first_plot + second_plot
Produce this werid situation where the two legend overlap on the right: