1

I have a plotly graph made in ggplot2. I am displaying the graphics using face_grid but the y axis is very long. Because of this not all the words on the y axis are visible. Is there a way to split the text into two lines such that the entire y axis is visible?

majors.sub.HS<- majors.sub[, c(8:10, 66)] 

majors.sub.HS<-melt(majors.sub.HS, id.vars = "Major" )

majors.sub.HS$value[majors.sub.HS$value=="5- Highly Supported"] <- 5
majors.sub.HS$value[majors.sub.HS$value=="1- Not Supported"] <- 1

majors.sub.HS$value<- as.numeric (majors.sub.HS$value)

summary (majors.sub.HS)

p3<-ggplot(majors.sub.HS, aes(x=value, fill=Major)) +
        geom_bar(stat="count", alpha=0.85, color="black")  + facet_grid(variable~Major, scales='free_y')  + 
        theme_light() + scale_fill_brewer(palette="Dark2")
p3 <- ggplotly(p3)
p3

enter image description here

enter image description here

enter image description here

I Del Toro
  • 913
  • 4
  • 15
  • 36
  • Possible duplicate of [facet\_grid labeller two lines](https://stackoverflow.com/questions/41827592/facet-grid-labeller-two-lines) – A. Suliman Aug 22 '18 at 13:38
  • Not really the same post, as the example you mentioned has a two ID columns displayed. I only have one. Perhaps its an issue with my text being separated by periods? – I Del Toro Aug 22 '18 at 14:11
  • Can you please copy-past `head(dput(majors.sub.HS),n=20)` – A. Suliman Aug 22 '18 at 14:14
  • try `facet_wrap(~var,nrow = 3, labeller = label_wrap_gen(width = 25,multi_line = TRUE))` – Mike Aug 22 '18 at 15:48

0 Answers0