-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
transparent theme #5018
base: main
Are you sure you want to change the base?
transparent theme #5018
Conversation
For the various backgrounds, is there a reason you use rectangles with fill color transparent rather than |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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! |
I know... yet another theme. This one is best for presentations with non-standard background colors.