问题
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
来源:https://stackoverflow.com/questions/51968039/labeling-facet-grid-with-multiple-lines-of-text-on-y-label