# Some dummy data with a long string
df <- data.frame(
short = "X",
long = "A very long string that takes up a lot of space",
value = 1
)
# Simple plot
p <- ggplot(df, aes(value, value)) +
geom_point() +
theme(strip.text.y.right = element_text(angle = 0))
# Short titles take up as much space as long titles
p + facet_grid2(
vars(short, long),
strip = strip_vanilla(size = "constant")
)
# Short titles take up less space
p + facet_grid2(
vars(short, long),
strip = strip_vanilla(size = "variable")
)
Run the code above in your browser using DataLab