[R] xlim in lattice

Deepayan Sarkar deepayan at stat.wisc.edu
Sun Dec 26 01:02:15 CET 2004


On Saturday 25 December 2004 16:29, Edwin Leuven wrote:
> dear all,
>
> i do the following (using ecdf from Hmisc, but that in turn uses
> lattice):
>
> ecdf(~stp | year*abil, group = bonus )
>
> where year*abil defines 2x2 = 4 groups (and i've put year first so
> that years are columns since i want to manipulate the x-axis)
>
> the scale of stp is very different for the 2 years, and i want
> xlim=c(0,60) when year=1, and xlim=c(0,280) when year=2.
>
> i've been trying to solve this seemingly trivial problem for the last
> 3 hours and still have no clue.
>
> does anyone know how to achieve this?

Well, going as far as 

ecdf(~stp | year*abil, group = bonus,
     scales = 
     list(x = list(relation = "free", 
          limits = list(c(0, 60), c(0, 280), c(0, 60), c(0, 280)))))

should be easy enough. Unfortunately, it's not as easy to get rid of the 
labels from the first row. It's still possible, if you are desperate 
enough, but it's not very clean:

ecdf(~stp | year*abil, group = bonus,
     scales = 
     list(x = list(relation = "free", 
          limits = list(c(0, 60), c(0, 280), c(0, 60), c(0, 280)),
          at = list(TRUE, TRUE, NULL, NULL))),
     par.settings = list(layout.heights = list(axis.panel = c(1, 0))))

(this is assuming R 2.0.x)

Deepayan




More information about the R-help mailing list