[R] RES: How to force axis to have the same range

Deepayan Sarkar deepayan.sarkar at gmail.com
Wed Apr 22 17:57:49 CEST 2009


On 4/22/09, Sebastien Bihorel <Sebastien.Bihorel at cognigencorp.com> wrote:
> Thanks to all the people who answer my question. It is know clear to know
> how to produce a square shape graph... but I guess there is no easy way to
> force the x and the y axis to have the same limits.

If you mean the general case where you don't want to specify xlim and
ylim explicitly, then in lattice you can use

xyplot(...
       prepanel = function(x, y, ...) {
           rng <- range(x, y, finite = TRUE)
           list(xlim = rng, ylim = rng)
       })

-Deepayan




More information about the R-help mailing list