Skip to content

plot_annotation titles are removed when assembling or wrapping plots #209

Description

@msto

Hi,

I've found that titles added to a plot assembly are removed when trying to combine multiple assemblies into a larger figure.

I've extended the example in the assembly documentation page to demonstrate the issue. I'm able to add "Row1" and "Row2" to assemblies of the first and second plots and third and fourth plots, but these titles are removed when combining the assemblies with the stack operator (/) or wrap_plots().

I think this is a bug and not intended behavior, as using wrap_plots() with ncol=1 has the expected behavior of treating the sub-assemblies as individual plots, but please let me know if this is intended, or if I can add any other info.

Thanks!

library(ggplot2)
library(patchwork)

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')
combo1 <- (p1 + p2) + plot_annotation("Row 1")
combo1

combo1

combo2 <- (p3 + p4) + plot_annotation("Row 2")
combo2

combo2

combo1 / combo2

stacked

wrap_plots(combo1, combo2, ncol=1)

wrapped

Activity

  1. thomasp85 commented on Oct 2, 2020

    @thomasp85
    Owner

    This is a known limitation and is documented. At some point in the future I'll think about how to get around it

  2. msto commented on Oct 2, 2020

    @msto
    Author

    Totally missed that note in the annotation docs, sorry. Thanks

  3. psychelzh commented on Apr 28, 2021

    @psychelzh

    Is there any workaround for this?

  4. abanihas commented on Jun 22, 2021

    @abanihas

    @psychelzh @msto Same problem. Temporary solution in #145

  5. trizniak commented on May 30, 2026

    @trizniak

    Is there any workaround for this?

    I wrapped the plots in the list in patchwork::wrap_elements before the list goes into patchwork::wrap_plots

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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