简体   繁体   English

R中的柔性对角线图

[英]Flexible diagonal line plot in R

How can we plot diagonal across (from bottom-left-hand corner to top right-hand corner), at any given coordinate ranges? 在任何给定的坐标范围内,我们如何绘制对角线(从左下角到右上角)?

For example 例如

> plot(c(-2,3), c(-1,5), type = "n", xlab="x", ylab="y", asp = 1)

or 要么

> plot(c(0,1000), c(0,334), type = "n", xlab="x", ylab="y", asp = 1)

I tried abline with the following but failed: 我尝试使用以下内容但是失败了:

> abline(0,1,col="red")

当前绘图区域的限制在par()$usr

lines( par()$usr[1:2], par()$usr[3:4] )

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

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