-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Description
This was identified in #6287 and affects 16 packages.
You can add NULL
to a regular theme and it will be a no-op.
However, some packages don't also have the "gg"
class for their themes, which causes problems when adding NULL
.
library(ggplot2)
class(theme())
#> [1] "theme" "gg"
class(survminer::theme_survminer())
#> [1] "theme"
theme() + NULL
#> Named list()
#> - attr(*, "class")= chr [1:2] "theme" "gg"
#> - attr(*, "complete")= logi FALSE
#> - attr(*, "validate")= logi TRUE
survminer::theme_survminer() + NULL
#> Error in survminer::theme_survminer() + NULL: non-numeric argument to binary operator
Created on 2025-01-22 with reprex v2.1.1
This can become a problem in the chunk of code below:
Lines 541 to 549 in 6a61201
adjust <- NULL | |
position <- groups$key$position[i] | |
if (position == "inside") { | |
adjust <- theme( | |
legend.position.inside = groups$key$coord[[i]], | |
legend.justification.inside = groups$key$justs[[i]] | |
) | |
} | |
grobs[[i]] <- self$package_box(grobs[[i]], position, theme + adjust) |
Metadata
Metadata
Assignees
Labels
No labels