Closed jwhendy closed 4 months ago
The problem is
theme(strip_background=element_blank())
removes the box around the facet labels. The layout manager uses the box to account for the space taken by the labels.
Is it a dumb/hacky fix to adjust L28 to specify a transparent strip_background vs. fixing via the layout manager (which to my unfamiliar ear, sounds much more involved)?
Googling around, it seems transparency can be specified in RGB codes like #AARRGGBB
, as long as the backend will accept the additional alpha parameter. Having found that, I tried this and it works:
p = ggplot(foo, aes(x='x', y='y', group=1)) + geom_line()
p = p + facet_wrap('~label')
p = p + theme_minimal()
p = p + theme(strip_background=element_rect(fill="#00000000", color="#00000000"))
p
Showing here with an additional theme arg so things are not transparent:
p = p + theme(plot_background=element_rect(fill="white"))
p
Not sure if there are other byproducts of setting strip_background
to an element_rect
vs. element_blank
...
Is it a dumb/hacky fix to adjust L28 to specify a transparent strip_background vs. fixing via the layout manager (which to my unfamiliar ear, sounds much more involved)?
This is a real bug based on a wrong assumption, and requires fixing it in the layout manager has to be fixed. I have a working solution and I'll make a release on Friday.
In the meantime, you should be able to use theme(strip_background=element_rect(fill="none", color="none"))
Hello, I've never run into this before so I'm suspecting it's some kind of regression. Here's a repro:
By default we get:
And trying a few others:
However with
theme_minimal()
the facet labels are removed. You can try this without the additional plot background arguments totheme()
, but the result is the same. I'm including it so it's white and easily seen vs. the default transparent bg: