Home > OS >  Shift facet label to the left so that y-axis has some more space
Shift facet label to the left so that y-axis has some more space

Time:09-17

I am trying to give my y axis labels a room to breath, by shifting the my facet lables a bit to the left. I am not sure how best to do this on ggplot. Does anyone have a suggestion on how best to do this?enter image description here

CodePudding user response:

The theme setting you might be looking for is strip.switch.pad.grid.

library(ggplot2)

p <- ggplot(mpg, aes(hwy, class))  
  geom_col()  
  facet_grid(year ~ ., switch = "y")  
  theme(strip.placement = "outside")
p

p   theme(strip.switch.pad.grid = unit(1, "cm"))

Created on 2021-09-14 by the reprex package (v2.0.1)

CodePudding user response:

You can just add theme(strip.placement = "outside") in your code. It should work.

  • Related