Skip to content

Patchwork of patwchrok does not handle properly legends #432

Description

@dmongin

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")

Image

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")

Image

But:

first_plot + second_plot

Produce this werid situation where the two legend overlap on the right:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions