r - 使用旋转 X 轴在 R 中绘制效果图
问题描述
搜索了几个小时后,我会在这里直接问:
如何在效果图中旋转 x 轴的标签?
绘制效果没有问题:
kiri.eff <- Effect(c("words", "otherwords"), kiri)
(其中 'kiri' 是一个线性混合效果模型,由lmer()
and 制成)它适用于
plot(kiri.eff, multiline = T, ci.style = "bars")
因此,我尝试绘制这样的向量:
words otherwords RT
word1 other1 1.67
word1 other2 2.65
word2 other1 1.8
word3 other2 2
word2 other2 1.4
word3 other1 2.3
本质上,RT 的(统计)效果分别绘制到所使用的单词和其他单词上。
但是现在似乎没有办法在 x 轴上旋转标签。我尝试las = 2
了其他方法,par()
而没有对绘图进行任何更改 - 分别是 x 轴 - 本身。我也试着用它来绘制它ggplot()
,但它似乎与效果无关——或者我做得不对。
我感谢任何帮助。
最好的,基里
解决方案
使用库的一种可能解决方案ggplot2
是使用element_text()
. 正如您在下面看到的,x-axis
标签聚集在一起。
library(ggplot2)
data(diamonds)
diamonds$cut <- paste("Super Dee-Duper",as.character(diamonds$cut))
q <- qplot(cut,carat,data=diamonds,geom="boxplot")
q
通过应用 来旋转 x 轴标签element_text()
。
q + theme(axis.text.x = element_text(angle = 90, hjust = 1))
因此,更改 in 的值angle
以element_text()
获得所需的结果。
推荐阅读
- jquery - 无法使用 jQuery 选择器抓取图像
- javascript - 在Node js中登录身份验证时出错
- java - 每当我运行由 java.lang.nullpointerException 引起的应用程序时,我都会收到此错误:findViewbyId(R.id.btn_start)must not be null
- python - Tkinter 窗口浮动在 i3 中,但也适用于 MS-Windows
- javascript - 过滤不等于特定文本jqgrid的数据
- flutter - 颤振中的上下文问题“未定义的名称'上下文'”
- docker - 使用 docker 运行 jmeter
- cypress - 与赛普拉斯的元素查询不一致
- blockchain - 如何通过保持相同的 CID 将文件上传到 IPFS
- google-chrome - 加载资源失败:服务器响应状态为 401 ()