Rotating y axis labels with mosaic plots

末鹿安然 提交于 2019-12-12 19:01:14

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!