[英]Y-axis values does not display correctly on my gap.boxplot in R
This is my script and the graph produced.这是我的脚本和生成的图表。 I have made a gap between 7-29.8.
我在 7-29.8 之间做了一个差距。 But How can I display the y-axis values at 7 and 30?
但是如何在 7 和 30 处显示 y 轴值? The axis only shows 1-6, instead of 0-7 , 30 as intended.
该轴仅显示 1-6 ,而不是预期的 0-7 、 30 。
gap.boxplot(Km, gap=list(top=c(7,30), bottom=c(NA,NA), axis(side=2, at=c(0,29.8), labels= F)),
ylim=c(0,30), axis.labels=T, ylab="Km (mM)", plot=T, axe=T,
col=c("red","blue","black"))
abline(h=seq(6.99,7.157,.001), col="white")
axis.break(2, 7.1,style="slash")
You can call the axis
function again to plot the marks at c(0:7,30)
您可以再次调用
axis
函数以绘制c(0:7,30)
处的标记
axis(2,c(0:7,30)
But because you have a gap between 7
and 30
, anything beyond 7
will have to be shifted in the plot.但是因为你在
7
和30
之间有一个差距,任何超过7
东西都必须在情节中移动。 In general, a mark at position y
will have to be moved downwards to y-gap.width
, or y-(30-7)
in your case.通常,位置
y
处的标记必须向下移动到y-gap.width
,或者在您的情况下移动到y-(30-7)
。
So you can do this to plot your marks:所以你可以这样做来绘制你的标记:
axis(2, labels=c(0:7,30), at=c(0:7,30-(30-7)))
It's hard to replicate the plot without example data.如果没有示例数据,很难复制该图。 But I think this worth a try and should work.
但我认为这值得一试并且应该有效。
axis(2,labels=c(0:7), at=c(0:7)) # build first gap marker '7'
then separately add the second gap marker然后分别添加第二个间隙标记
axis(2, labels=c(30), at=7*(1+0.01)) # the interval (0.01) could be different, test to find the best one to fit your plot
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.