Reputation: 13
When splitting a basic bar plot with facet_wrap, the strip titles are drawn behind and barely above the plot area, meaning any character descenders are cut off. Is there a way I can space these a little? The problem persists whether or not I use ggthemr.
Thanks!
Example of what I'm talking about:
Upvotes: 1
Views: 272
Reputation: 1344
You can specify the margins of the element by adding it in the strip.text.x argument, as follows:
A = data.frame(x = 1:4, y = 1:4, z = c('A','A','B','B'))
ggplot(A) +
geom_point(aes(x = x, y = y)) +
facet_wrap(~z) +
theme_bw()+
theme(strip.text.x = element_text(margin = margin(2,0,2,0, "cm")))
Upvotes: 2