I have the following type of plot and want to keep each strip text above the individual facet box as a "title" of sorts yet not have the default grey background and black border around the strip.background
. I color it white which is close to what I want but would like the bottom edge of the strip.background
or top edge of panel.border
to be black.
library(ggplot2) ggplot(mtcars, aes(mpg, hp)) + geom_point() + facet_wrap(~carb, ncol = 3) + theme_bw() + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), strip.background = element_rect(colour="white", fill="white"), panel.border = element_rect(colour = "black"))
If you set element_blank()
for strip.background
and keep element_rect(colour="black", fill = NA)
for panel.border
then top edge of panel.border
will be black. As pointed out by @adrien, for panel.background
fill should be set to NA to avoid covering of points (already set as default for theme_bw()
).
ggplot(mtcars, aes(mpg, hp)) + geom_point() + facet_wrap(~carb, ncol = 3) + theme_bw() + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), strip.background = element_blank(), panel.border = element_rect(colour = "black", fill = NA))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With