Skip to content

Can we deprecate guides(... = FALSE)? #4097

Closed
@yutannihilation

Description

@yutannihilation

I happened to know guides() accepts FALSE as an option not to show the legend. e.g https://stackoverflow.com/a/14604540

p + guides(colour = FALSE)

I think none of the official documentation refers to this usage, and no test is broken if I remove this isFALSE(guide), so I think this is safe to remove. At least we should start encouraging people to use "none" as it is the supposed way. The only concern is that I cannot understand what this comment exactly means.... This has been here for 9 years since the point where the S3 guide system was born (0795c6f)...

ggplot2/R/guides-.r

Lines 187 to 190 in b4e3aea

# this should be changed to testing guide == "none"
# scale$legend is backward compatibility
# if guides(XXX=FALSE), then scale_ZZZ(guides=XXX) is discarded.
if (identical(guide, "none") || isFALSE(guide) || inherits(guide, "guide_none")) next

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