diff --git a/R/plot-render.r b/R/plot-render.r index 5ea6e3a916..cc4b54a61c 100644 --- a/R/plot-render.r +++ b/R/plot-render.r @@ -149,9 +149,9 @@ ggplot_gtable <- function(data) { plot_table <- gtable_add_rows(plot_table, theme$plot.margin[3]) plot_table <- gtable_add_cols(plot_table, theme$plot.margin[4], pos = 0) - if (inherits(theme$plot.background, "theme")) { + if (inherits(theme$plot.background, "element")) { plot_table <- gtable_add_grob(plot_table, - theme_render(theme, "plot.background", vp = "background"), + element_render(theme, "plot.background"), t = 1, l = 1, b = -1, r = -1, name = "background", z = -Inf) plot_table$layout <- plot_table$layout[c(nrow(plot_table$layout), 1:(nrow(plot_table$layout) - 1)),] plot_table$grobs <- plot_table$grobs[c(nrow(plot_table$layout), 1:(nrow(plot_table$layout) - 1))] diff --git a/visual_test/themes.r b/visual_test/themes.r index 0a21d3dc81..f463a39497 100644 --- a/visual_test/themes.r +++ b/visual_test/themes.r @@ -66,4 +66,11 @@ p + t save_vtest("text is element_blank - result is no text") +# Testing specific elements +p + theme(axis.text = element_blank(), axis.ticks = element_blank(), + axis.title = element_blank(), axis.ticks.margin = unit(0, "cm"), + plot.background = element_rect(fill = "lightblue"), + panel.border = element_rect(colour = "black", size = 4, fill = NA)) +save_vtest("many blank items, and light blue plot background") + end_vcontext() \ No newline at end of file