简体   繁体   English

如何绘制不与R中的Y轴相交的abline()?

[英]How to draw abline() that doesn't intersect the Y-axis in R?

I have a location quotient plot drawn in R and want to draw a horizontal line along the plot where Y = 1. I have the code abline(h=1, col="black") but when the line is drawn, it intersects the Y-axis and crosses out my Y-axis labels. 我有一个用R绘制的位置商图,并想沿着该图在Y = 1处绘制一条水平线。我有代码abline(h=1, col="black")但是绘制该线时,它与Y轴并与我的Y轴标签交叉。

Does anyone know how to terminate the line at the Y-axis rather than having it intersect? 有谁知道如何在Y轴处终止线而不是使其相交?

Many thanks. 非常感谢。

As mentioned in the comments, it looks like the parameter xpd has been changed, so one option is to change it back to FALSE , see ?par . 如注释中所述,参数xpd似乎已更改,因此一种选择是将其更改回FALSE ,请参见?par you can control the clipping region using the clip function to further limit the range that abline and other functions plot within. 您可以使用clip功能控制裁剪区域,以进一步限制abline和其他功能在其中绘制的范围。 This may also be affected by you plotting device (different devices can deal with clipping differently). 这可能也会受到绘图设备的影响(不同的设备可能会以不同方式处理裁剪)。

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

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