Skip to content

ggtitle overwrites subtitle #2446

@ptoche

Description

@ptoche

Not a big deal: ggtitle() overwrites subtitle

ggplot(data=mtcars, aes(x=mpg, y=cyl)) + geom_point() + labs(title="title", subtitle="subtitle")
p = last_plot()
p + ggtitle("title2")  # overwrites subtitle
p + labs(title="title2")  # does not overwrite subtitle

Below I tried to use reprex(clipr::read_clip()), but it doesn't seem to work too well...

#> [1] "library(ggplot2)"
#> [2] "ggplot(data=mtcars, aes(x=mpg, y=cyl)) + geom_point() + labs(title="title", subtitle="subtitle")"
#> [3] "p = last_plot()"
#> [4] "p + ggtitle("title2") # overwrites subtitle"
#> [5] "p + labs(title="title2") # does not overwrite subtitle"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions