[R] multiple plots
Chuck Cleland
ccleland at optonline.net
Tue Jun 7 20:53:21 CEST 2005
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 dont 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 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
>
>
--
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
More information about the R-help
mailing list