Skip to content

Commit 1050f09

Browse files
authored
preserve theme class (#5823)
1 parent e8b62f6 commit 1050f09

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

R/theme.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -576,8 +576,9 @@ plot_theme <- function(x, default = theme_get()) {
576576
# Check that all elements have the correct class (element_text, unit, etc)
577577
validate_theme(theme)
578578

579-
580-
theme[intersect(names(theme), names(get_element_tree()))]
579+
# Remove elements that are not registered
580+
theme[setdiff(names(theme), names(get_element_tree()))] <- NULL
581+
theme
581582
}
582583

583584
#' Modify properties of an element in a theme object

0 commit comments

Comments
 (0)