Open nrennie opened 10 months ago
You can define your own theme and can get the same effect as theme_void().
library(ggplot2)
library(ggfx)
# Example from documentation
implode <- function(x, factor = 0.5) {
vp <- magick::image_read(get_viewport_area(x))
vp <- magick::image_implode(vp, factor = factor)
set_viewport_area(x, as.raster(vp, native = TRUE))
}
nothing <-
theme(
plot.background = element_rect(fill = "#ffffff"),
panel.background = element_rect(fill = "#ffffff"),
panel.grid = element_blank(),
axis.title = element_blank(),
axis.text = element_blank(),
axis.ticks = element_blank(),
legend.position = "none"
)
ggplot(mtcars, aes(x = factor(gear), y = disp)) +
with_custom(
geom_boxplot(aes(fill = as.factor(gear))),
filter = implode
) +
nothing
Adding
theme_void()
to a plot with a custom filter using Magick results in an error. When testing with other theme functions such astheme_minimal()
ortheme_classic()
it works fine. Small reprex based on the example in the documentation:Created on 2023-08-25 with reprex v2.0.2