diff --git a/NAMESPACE b/NAMESPACE index 5737492a00..852cb97600 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -461,7 +461,6 @@ export(guides) export(has_flipped_aes) export(is.Coord) export(is.coord) -export(is.element) export(is.facet) export(is.geom) export(is.ggplot) @@ -475,6 +474,7 @@ export(is.position) export(is.scale) export(is.stat) export(is.theme) +export(is.theme_element) export(label_both) export(label_bquote) export(label_context) diff --git a/R/guide-.R b/R/guide-.R index dd63949cd2..fc002c33d2 100644 --- a/R/guide-.R +++ b/R/guide-.R @@ -381,7 +381,7 @@ Guide <- ggproto( # Renders tickmarks build_ticks = function(key, elements, params, position = params$position, length = elements$ticks_length) { - if (!is.element(elements)) { + if (!is.theme_element(elements)) { elements <- elements$ticks } if (!inherits(elements, "element_line")) { diff --git a/R/plot-build.R b/R/plot-build.R index c7e641c8e6..a624469b75 100644 --- a/R/plot-build.R +++ b/R/plot-build.R @@ -288,7 +288,7 @@ ggplot_gtable.ggplot_built <- function(data) { plot_margin <- calc_element("plot.margin", theme) plot_table <- gtable_add_padding(plot_table, plot_margin) - if (is.element(theme$plot.background)) { + if (is.theme_element(theme$plot.background)) { plot_table <- gtable_add_grob(plot_table, element_render(theme, "plot.background"), t = 1, l = 1, b = -1, r = -1, name = "background", z = -Inf) diff --git a/R/theme-elements.R b/R/theme-elements.R index 7e5de2f777..fb3341bf49 100644 --- a/R/theme-elements.R +++ b/R/theme-elements.R @@ -204,7 +204,7 @@ element_geom <- function( #' @export #' @rdname is_tests -is.element <- function(x) inherits(x, "element") +is.theme_element <- function(x) inherits(x, "element") #' @export print.element <- function(x, ...) utils::str(x) diff --git a/R/theme.R b/R/theme.R index 2eedd300c5..2eecc13253 100644 --- a/R/theme.R +++ b/R/theme.R @@ -529,7 +529,7 @@ theme <- function(..., # If complete theme set all non-blank elements to inherit from blanks if (complete) { elements <- lapply(elements, function(el) { - if (is.element(el) && !inherits(el, "element_blank")) { + if (is.theme_element(el) && !inherits(el, "element_blank")) { el$inherit.blank <- TRUE } el diff --git a/man/is_tests.Rd b/man/is_tests.Rd index 62ded3db09..bcb7bf0683 100644 --- a/man/is_tests.Rd +++ b/man/is_tests.Rd @@ -10,7 +10,7 @@ \alias{is.Coord} \alias{is.facet} \alias{is.stat} -\alias{is.element} +\alias{is.theme_element} \alias{is.guide} \alias{is.layer} \alias{is.guides} @@ -36,7 +36,7 @@ is.facet(x) is.stat(x) -is.element(x) +is.theme_element(x) is.guide(x)