[R] Positioning in xyplot

Sundar Dorai-Raj sundar.dorai-raj at pdf.com
Wed Apr 11 00:34:52 CEST 2007



Michael Kubovy said the following on 4/10/2007 3:21 PM:
> Dear R-helpers,
> 
> I have an xyplot
> 
> of the following kind:
> xYplot(y ~ x | p, groups = factor(gg, levels = c('1', '5', '2', '4',  
> '3')),
> 	strip = strip.custom(var.name = 'g', factor.levels = c(1', '5', '2',  
> '4', '3'),
> 		strip.levels = T, strip.names = T, sep = ' = ', shingle.intervals =  
> NULL),
> 	data = df, type = 'b', label.curves = F, layout = c(2, 3),
> 	)
> 
> Currently this puts the panels as follows
> 
> 3
> 2  4
> 1  5
> 
> I need:
> 
>    3
> 2   4
> 1   5
> 
> How can I do this? Any help will be much appreciated.
> 
> _____________________________
> Professor Michael Kubovy
> University of Virginia
> Department of Psychology
> USPS:     P.O.Box 400400    Charlottesville, VA 22904-4400
> Parcels:    Room 102        Gilmer Hall
>          McCormick Road    Charlottesville, VA 22903
> Office:    B011    +1-434-982-4729
> Lab:        B019    +1-434-982-4751
> Fax:        +1-434-982-4766
> WWW:    http://www.people.virginia.edu/~mk9y/
> 
> ______________________________________________
> 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, Michael,

Use the skip argument.

library(lattice)
z <- expand.grid(x = 1:10, y = 1:10, p = 1:5)
z$p <- factor(z$p, levels = c(1, 5, 2, 4, 3))
xyplot(y ~ x | p, z, layout = c(2, 3),
        skip = c(FALSE, FALSE, FALSE, FALSE, TRUE, FALSE))


Also you are using xYplot (presumably from Hmisc) and not lattice::xyplot.

Thanks,

--sundar



More information about the R-help mailing list