Skip to content

How to cancel/NULLify a title? #198

@MatthieuStigler

Description

@MatthieuStigler

Hi

It seems that if a main title has been added with plot_annotation(title), it is not possible to remove it/NULLify it ex-post? This is possible with ggplot2 with ggtitle(NULL), and very useful (say keep for analysis plots with title yet remove titles for publication, as title will be included in the text software?), is it possible to do with patchwork too?

Thanks!

library(ggplot2)
library(patchwork)
packageVersion("patchwork")
#> [1] '1.0.1.9000'

p1 <- ggplot(mtcars) + geom_point(aes(mpg, disp)) + ggtitle("Some Tiltle")
p2 <- ggplot(mtcars) + geom_boxplot(aes(gear, disp, group = gear))

## Standrad ggplot allows to NULLify a title
p1 + ggtitle(NULL)

# But not possible with patchwork?
p3 <- p1 + p2 + plot_annotation('This is a title I want to remove ex-post', caption = 'made with patchwork')
p3 + plot_annotation(title=NULL)

Created on 2020-07-01 by the reprex package (v0.3.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurea feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions