问题
I am in an intro R class and was wondering how to rotate axis labels on the y axis with mosaic plots (vcd package). They are long labels and right now are completely overlapping each other. I would like to make them perpendicular to the rest of the plot (horizontal rather than vertical). I have tried the the ggplot lingo I am familiar with, las=, and str=, but nothing seems to have an effect.
Here's my existing code:
```{R}
# mosaic plot
library(vcd)
mosaic(~ USfuture + Education, data = OOL.sub, shade=TRUE, legend=TRUE, direction = "v")
```
Thank you!
回答1:
It is unclear to me what you mean by the "y labels", but if you mean the left side labels, then this should do what you request:
mosaic(~ USfuture + Education, data = OOL.sub, shade=TRUE, legend=TRUE,
direction = "v", rot_labels=c(0,90,0,0) )
See:
help( labeling_border, pac=vcd)
I had a couple of concerns about your understanding of the particular plotting paradigm being used. For one thing las
is a base parameter. For another the vcd::mosaic function calls strucplot
and the code shows it is a pure grid function, so neither ggplot functions nor lattice functions are likely to be helpful.
来源:https://stackoverflow.com/questions/33492061/rotating-y-axis-labels-with-mosaic-plots