简体   繁体   English

打破箱线图xlim间隔

[英]Breaking boxplot xlim interval

My boxplot has a range 1 to 121 on the x axis, with breaks of 1. 我的箱线图在x轴上的范围是1到121,间隔为1。

My boxplot code: 我的箱线图代码:

boxplot(data, xlab="No f bags", xlim=(1,121))

How can I plot the boxplot by applying breaks to axis follows: 如何通过将中断应用于轴来绘制箱线图,如下所示:

1, 20, 40, 60, 80, 100, 120 1,20,40,60,80,100,120

Thanks 谢谢

See the example below: 请参阅以下示例:

data<-data.frame(a=runif(200,min=1,max=121))

boxplot(data$a,xlab='No f bags',ylim=c(1,121),yaxt='n')

在此处输入图片说明

The yaxt argument in boxplot removes the default y-axis labeling R provides. 所述yaxt在参数boxplot删除缺省y轴的标记- [R提供。

axis(side=2,at=c(1,20,40,60,80,100,120))

在此处输入图片说明

The final line of code with the axis function now tells R to establish a new y-axis at the following breaks. 现在,带有axis功能的代码的最后一行告诉R在以下中断处建立新的y轴。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM