Closed barrel0luck closed 3 years ago
That's just how ggplot2 themes work. Nothing to do with ggtext in particular.
So in your opinion when I code in strip.text = element_textbox()
what should that get applied to? Just the x strips or both x and y strips?
Most themes explicitly set strip.text.y = element_text(...)
so setting strip.text = element_textbox()
won't override that setting. You'll have to set strip.text.y
also.
Ok. I guess I was just used to changing everything with one shot using strip.text = element_text()
. Thanks anyway and I have to tell you it's really easy to format complex stuff with ggtext. After years of struggling with expression and bquote, finding ggtext is like finding an oasis in a desert. Thanks for developing this package. It's longer to write stuff for sure, but much more intuitive since I'm used to markdown language.
The logic of using
element_textbox
withintheme()
seems to be different from that ofelement_text()
which made me think there was a bug in the code for a long period of time. Specifically, when faceting data usingfacet_grid
, and usingstrip.text = element_textbox()
to format the facet text, the formatting gets applied only to the x strip instead of both x and y strips. Withstrip.text = element_text()
the formatting gets applied to both x and y strips. However, withelement_textbox()
to be able to apply formatting to y strip, you need an additional line intheme()
, i.e.strip.text.y = element_textbox()
. This is a bit confusing, especially if you're used to the usual theme logic.