Re: [R] multiple plots

From: Chuck Cleland <ccleland_at_optonline.net>
Date: Wed 08 Jun 2005 - 04:53:21 EST

How about this:

myframe <- expand.grid(p1 = rnorm(10), p2 = rnorm(10),

                        classes = paste("class", 1:10, sep=""),
                        colors = c("blue", "red", "green", "yellow", 
"orange", "purple"))

library(lattice)

xyplot(p2 ~ p1 | classes * colors, data=myframe)

If you want the 60 panels on more than one page, see the layout argument to xyplot. For example,

xyplot(p2 ~ p1 | classes * colors, data=myframe, layout=c(6,5,2))

alex diaz wrote:
> Hi:
> I am learning to use R and I am experiencing some
> difficulties in writing a function to produce multiple
> plots.
> This is a single plot
>
> Subset(myframe, color==”blue” & class==1)
> Plot(myframe$p1, myframe$p2)
>
> My problem is that I have six colors (blue, red,
> green,....) and 10 classes, that is 60 graphs! I think
> I can use par(mfrow=c(8,8)), but I don’t know how to
> generate such number of plots in a parsimonious way.
> Can someone give me a hand please?
>
> alex
>
> -------------------------------------------------
> Email Enviado utilizando o serviço MegaMail
>
> ______________________________________________
> R-help@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
>
>

-- 
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 452-1424 (M, W, F)
fax: (917) 438-0894

______________________________________________
R-help@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
Received on Wed Jun 08 04:58:29 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:27 EST