Skip to content

Malformed old guides #6165

Closed
Closed
@teunbrand

Description

@teunbrand

This is what it should look like if you add a modern guide to guides():

devtools::load_all("~/packages/ggplot2")
#> ℹ Loading ggplot2

guides(x = guide_axis())
#> <Guides[1] ggproto object>
#> 
#> x : <GuideAxis>

However, an old S3 guide is stored incorrectly. You can see that by the guides printing as if fields of the S3 guide are separate guides:

guides(x = ggprism::guide_prism_minor())
#> Warning: The `<scale>` argument of `guides()` cannot be `FALSE`. Use "none" instead as
#> of ggplot2 3.3.4.
#> This warning is displayed once every 8 hours.
#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
#> generated.
#> <Guides[8] ggproto object>
#> 
#>         title : <waiver> 
#> check.overlap : "none"   
#>         angle : <NULL>   
#>       n.dodge : <numeric>
#>         order : <numeric>
#>      position : <waiver> 
#> available_aes : "x"      
#>          name : "y"      
#>         title : "axis"

Created on 2024-10-28 with reprex v2.1.1

The issue stems from #6022 in that we now use is.guide() here, which tests for the modern ggproto guide, while this clause was specifically designed for old S3 guides:

if (is.list(args[[1]]) && !is.guide(args[[1]])) args <- args[[1]]

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behaviorguides 📏

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions