Skip to content

update_geom_defaults() should class results #5145

Closed
@dkahle

Description

@dkahle

Using update_geom_defaults() and update_stat_defaults() don't class the updated list, so it prints differently. Example below. Will submit simple PR to fix presently.

library("ggplot2")

GeomPoint$default_aes
#> Aesthetic mapping: 
#> * `shape`  -> 19
#> * `colour` -> "black"
#> * `size`   -> 1.5
#> * `fill`   -> NA
#> * `alpha`  -> NA
#> * `stroke` -> 0.5

str(GeomPoint$default_aes)
#> List of 6
#>  $ shape : num 19
#>  $ colour: chr "black"
#>  $ size  : num 1.5
#>  $ fill  : logi NA
#>  $ alpha : logi NA
#>  $ stroke: num 0.5
#>  - attr(*, "class")= chr "uneval"

update_geom_defaults("point", list(size = 4))

GeomPoint$default_aes
#> $size
#> [1] 4
#> 
#> $shape
#> [1] 19
#> 
#> $colour
#> [1] "black"
#> 
#> $fill
#> [1] NA
#> 
#> $alpha
#> [1] NA
#> 
#> $stroke
#> [1] 0.5

class(GeomPoint$default_aes) <- "uneval"
GeomPoint$default_aes
#> Aesthetic mapping: 
#> * `size`   -> 4
#> * `shape`  -> 19
#> * `colour` -> "black"
#> * `fill`   -> NA
#> * `alpha`  -> NA
#> * `stroke` -> 0.5

Created on 2023-01-11 with reprex v2.0.2

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