5

我们如何在任何给定的坐标范围内绘制对角线(从左下角到右上角)?

例如

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

或者

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

我尝试了以下操作但失败了:

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

1 回答 1

9

当前绘图区域的范围在par()$usr.

lines( par()$usr[1:2], par()$usr[3:4] )
于 2012-03-12T05:33:59.810 回答