旋转带有镶嵌图的y轴标签 [英] Rotating y axis labels with mosaic plots

查看:96
本文介绍了旋转带有镶嵌图的y轴标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在R入门课程中,想知道如何使用镶嵌图(vcd软件包)在y轴上旋转轴标签.它们是长标签,现在彼此完全重叠.我想使它们垂直于图的其余部分(水平而不是垂直). 我尝试了las =和str =熟悉的ggplot术语,但似乎没有任何效果.

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.

这是我现有的代码:

```{R}
# mosaic plot
library(vcd)
mosaic(~ USfuture + Education, data = OOL.sub, shade=TRUE, legend=TRUE, direction = "v")
```

谢谢!

推荐答案

对我来说,"y标签"的含义尚不清楚,但是如果您指的是左侧标签,那么这应该可以满足您的要求:

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) )

请参阅:

help( labeling_border, pac=vcd)

关于您对所使用的特定绘图范例的理解,我有一些担忧.一方面,las是基本参数.另一个vcd :: mosaic函数调用strucplot,并且代码显示它是纯网格函数,因此ggplot函数和点阵函数都可能无济于事.

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.

这篇关于旋转带有镶嵌图的y轴标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆