kamula kamula - 8 days ago 5
R Question

get the axis to be the same in the pairs function

pairs(iris[,1:4])


enter image description here

will produce a set of scatter plots relating the 4 variables to each other.
It will scale each axis differently depending on the range of each variable.

Is there a way that I can instead set the axes to be the same for every plot?

Answer

You can pass xlim and ylim arguments into pairs():

pairs(iris[,1:4], xlim=c(0,8), ylim=c(0,8))