Question
Is there a way to prevent facet labels from being equal width (after rotation)
When I apply a facet_grid, sometimes the labels are quite wide, sometimes so wide that they don't fit, and I have to rotate them. This isn't a problem unless I want to facet by multiple different groups. In this case, it auto-sizes every single group's label to be the same as the longest label. A reproducible example should help clarify my meaning:
library(tidyverse)
data<-diamonds |> mutate(cut=paste("Super Duper Long Description Which Demonstrates The Issue",cut))
data |> filter(str_detect(cut,"(Ideal|Premium|Good)") & clarity%in%c("SI1","SI2","VS1","VS2")) |>
ggplot(aes(x=color,y=price)) +
geom_boxplot() +
facet_grid(cut+clarity~.) +
theme(strip.text.y = element_text(angle=0,vjust=0.5))
As you can see, the width of the longest label is applied to the "cut" strip as well.
In case it's not obvious, below is the desired output:
Is there a method to prevent this from happening? Or is this a bug that should be reported upstream?