Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何将直线形式 (5, 5) 添加到该图的无穷大?我使用 abline 但我不想要 5 到 5 之间的线,只是我需要 5 到无穷大。
x <- c(1:5); y <- x plot(x, y, type="l") abline(v= max(x), col="black", lwd=2, lty=2)
您可以使用segments和par('usr')提取现有的轴限制。我曾经lty=1表明它会延伸到绘图区域的边缘
segments
par('usr')
lty=1
plot(x,y,type = 'l') segments(x0 = max(x), y0 = max(y), y1 = par('usr')[4], lwd=2)