Skip to content
Prev 177643 / 398503 Next

How to force axis to have the same range

On Apr 20, 2009, at 12:18 PM, Dieter Menne wrote:

            
To satisfy both of his requests with xyplot, I think he also needs  
xlim and ylim:

  xy <-data.frame(x=1:10, y= rnorm(10)+5)
  xyplot(y ~ x, data=xy, aspect=1)
  xyplot(y ~ x, data=xy, aspect=1, ylim=c(0,11), xlim=c(0,11))

I was less successful in using xlim and ylim with plot, since it seems  
to handle the x-axis differently than the y-axis as far as padding out  
beyond the limits. I would typically need to set asp=0.85 to get what  
looked to ba a square plot. Suggest reading the documentation for  
plot.window() as a start.