Skip to content

Nested tags sometimes not working #457

@stitam

Description

@stitam

Related to #440, #445.

From examples at patchwork::plot_annotation()

library(ggplot2)

p1 <- ggplot(mtcars) + geom_point(aes(mpg, disp))
p2 <- ggplot(mtcars) + geom_boxplot(aes(gear, disp, group = gear))
p3 <- ggplot(mtcars) + geom_bar(aes(gear)) + facet_wrap(~cyl)

And then here I am expecting p2 and p3 to have nested tags and they work, I get "A", "B1", "B2":

p1 + (p2 + p3 + plot_layout(tag_level = 'new')) + plot_annotation(tag_levels = c('A', '1'))

But here I am expecting p1 and p2 to have a nested tag and there is no nesting, I get "A", "B", "C":

(p1 + p2 + plot_layout(tag_level = 'new')) + p3 + plot_annotation(tag_levels = c('A', '1'))

Is this a bug or do I misunderstand how nested tags work? Thanks for helping me with this.

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