0

I have created a ggplotly facet-wrap in ggplot2 (image below). For some reason modifying the theme does not do the increase the space between the axis labels and the axis numbers...is there a higher order parameter where that is configurated for ggplotly facet-wrap?.

Modifying this line does not change the spacing in the y axis

 theme(axis.title.y = element_text(margin = unit(c(10, 10, 10, 10), "mm")))

here is a reproducible example:

p=ggplot(mpg, aes(displ, hwy)) +
geom_point() +
facet_wrap(vars(class))+
theme(axis.title.y = element_text(margin = unit(c(100, 0, 0, 0), "mm")))

ggplotly(p)

enter image description here

Camilo
  • 153
  • 7
  • I haven't used ggplotly, but `margins()` is for the total plotting area. Have you tried `hjust` for horizontal placement and `vjust` for vertical placement instead? Try something like theme(axis.title.y = element_text(hjust = 0.5, vjust = 5), axis.title.x = element_text(hjust = 0.5, vjust = -2)). Play with the `vjust` and `hjust` values until you get the desired outcome. If the the axis titles disappear, increase the margin size – L Tyrone Mar 13 '23 at 22:43

0 Answers0