Skip to content

Default colour aesthetic in geom_polygon() set to string "NA"? #4279

Closed

Description

@mdlama

There might be a bug in the default aesthetics for geom_polygon(). It appears to be set to the string "NA" rather than NA. Here's a minimal reprex:

library(ggplot2)

geom_polygon()$geom$default_aes
#> Aesthetic mapping: 
#> * `colour`   -> "NA"
#> * `fill`     -> "grey20"
#> * `size`     -> 0.5
#> * `linetype` -> 1
#> * `alpha`    -> NA
#> * `subgroup` -> NULL

Created on 2020-12-01 by the reprex package (v0.3.0.9001)

Activity

  1. yutannihilation commented on Dec 2, 2020

    @yutannihilation
    Member

    Good catch. Probably "NA" still works because farver interprets it the same as NA (this is consistent with the behaviour of grDevices::col2rgb()), but I agree this should be NA. Do you want to contribute a pull request?

    farver::decode_colour(NA)
    #>       r  g  b
    #> [1,] NA NA NA
    farver::decode_colour("NA")
    #>       r  g  b
    #> [1,] NA NA NA

    Created on 2020-12-02 by the reprex package (v0.3.0)

  2. mdlama commented on Dec 2, 2020

    @mdlama
    ContributorAuthor

    Sure! I'll reference this issue in the pull request. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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