[R] multi panel plot using xyplot()

jim holtman jholtman at gmail.com
Tue Apr 7 00:56:22 CEST 2009


Why don't you use something like this to plot without having to
extract the clones:

 xyplot(height~year|factor(clone), x, group=code, layout=c(3,2))



On Mon, Apr 6, 2009 at 6:11 PM, Schreiber, Stefan
<Stefan.Schreiber at ales.ualberta.ca> wrote:
> Hi there,
>
> I hope you guys can help me with the following:
>
> If have a file like this:
>
> year    clone   code    height
> 1995    4       4-1     1
> 1996    4       4-1     2
> 1997    4       4-1     3
> 1995    4       4-2     1
> 1996    4       4-2     2
> 1997    4       4-2     3
> 1995    5       5-1     1
> 1996    5       5-1     2
> 1997    5       5-1     3
> 1995    5       5-2     1
> 1996    5       5-2     2
> 1997    5       5-2     3
> .       .       .       .
> .       .       .       .
> .       .       .       .
>
> 1.      I want to analyze the growth of 52 different clones replicated
> 25 times over a period of 19 years. Now I'd like to plot all replicates
> per clone for the given period to compare them.
>
> 2.      I did this first to subset all replicates per clone:
>
> dat<-vector('list',52)
> for (i in 1:52){
> dat[[i]]<-subset(x,clone==i)
> }
>
> 3.      Now I can plot all replicates per clone quite nicely using this
> command (for example clone 24):
>
> xyplot(ht~year, data=dat[[24]], groups=code,type="o",ylim=c(0,20),
> xlab="Year",ylab="Absolute Height [m]",auto.key=list(space = "right",
> points = FALSE, lines = TRUE))
>
> My question is now whether there is a way to arrange these 52 plots in 6
> plots per page? The argument par(mfrow=c(2,3)) isn't working here. Or
> does someone even has a better suggestion?
>
> THANKS A LOT!
>
> Stefan
>
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org 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.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?




More information about the R-help mailing list