[R] dotplot, dropping unused levels of 'y'

Sundar Dorai-Raj sundar.dorai-raj at pdf.com
Fri Sep 15 21:45:42 CEST 2006



Benjamin Tyner said the following on 9/15/2006 2:36 PM:
> In dotplot, what's the best way to suppress the unused levels of 'y' on 
> a per-panel basis? This is useful for the case that 'y' is a factor 
> taking perhaps thousands of levels, but for a given panel, only a 
> handfull of these levels ever present.
> 
> Thanks,
> Ben
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

Hi, Ben,

Use scales(x = list(relation = "free")) in your call to dotplot:

library(lattice)
z <- data.frame(x = rep(LETTERS[1:20], each = 4),
                 y = 1:80, g = gl(4, 20))
dotplot(y ~ x | g, z,
         scales = list(x = list(relation = "free")))

HTH,

--sundar



More information about the R-help mailing list