如何显示所有箱形图标签 [英] How do I show all boxplot labels
本文介绍了如何显示所有箱形图标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我创建了一个箱形图,左边的数据是连续变量,右边的数据有大约10个唯一选项.创建箱线图时,看不到标签.如何使它显示所有标签,可能垂直显示?
I've created a box plot, the data on the left is the continous variable and the data on the right has about 10 unique options. When I create the boxplot I cannot see the labels. How do I make it show all the labels, possibly vertically?
boxplot(data$Rate ~ as.factor(data$Purpose))
我环顾四周,无法确定我要遵循的目标.
I've looked around and cannot work out what im trying to follow.
推荐答案
您可以将参数 las = 2
添加到函数 boxplot()
中,以使所有标签垂直于轴
You can add argument las=2
to function boxplot()
to make all labels perpendicular to axis.
df<-data.frame(Rate=rnorm(100),Purpose=rep(letters[1:10],each=10))
boxplot(df$Rate~df$Purpose,las=2)
如果标签名称很长,则还应调整打印边距.
If your label names are long then you should adjust also plot margins.
par(mar=c(7,5,1,1))
boxplot(df$Rate~df$Purpose,las=2)
这篇关于如何显示所有箱形图标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文