Repository navigation
transparent theme - #5018
transparent theme#5018
Conversation
|
For the various backgrounds, is there a reason you use rectangles with fill color transparent rather than |
thomasp85
left a comment
There was a problem hiding this comment.
@teunbrand can you look into updating this to the newest theme style (using ink and paper etc)
|
This is now updated to latest theme changes. In the example below, that causes the gridlines to always be darker over the background and not lighter over the red parts. devtools::load_all("~/packages/main/ggplot2/")
#> ℹ Loading ggplot2
p <- ggplot(mpg, aes(displ, hwy)) +
geom_point() +
theme_transparent() +
facet_wrap(~"Strip title")
# Make rectangle pattern
rectangles <- rectGrob(
unit(c(0.25, 0.75), "cm"), unit(c(0.25, 0.75), "cm"),
width = unit(0.5, "cm"), height = unit(0.5, "cm"),
gp = gpar(fill = "red", col = NA)
)
pattern <- pattern(
rectangles,
x = unit(0.5, "cm"), y = unit(0.5, "cm"),
width = unit(1, "cm"), height = unit(1, "cm"),
extend = "repeat"
)
grid.newpage()
grid.draw(rectGrob(gp = gpar(fill = pattern, col = NA)))
grid.draw(ggplotGrob(p + theme_transparent()))Created on 2024-11-11 with reprex v2.1.1 |
|
Thanks for getting this over the finish line! |
|
Thanks Max and Thomas! |
This reverts commit f9b9703.

I know... yet another theme. This one is best for presentations with non-standard background colors.