[R] Lattice plot within a "for" loop does not happen?

Petr Pikal petr.pikal at precheza.cz
Fri May 13 16:21:11 CEST 2005


Hi

many times answered. Just enter

lattice loop R

into Google and you are there

Explicite printing lattice object is what you need.

Cheers
Petr


On 13 May 2005 at 10:09, George W. Gilchrist wrote:

> I am trying to do a series of xyplots plots, using a "for" loop to 
> substitute the appropriate variables for each plot. The basic command 
> works fine by itself and produces a nice plot:
> 
>  > i<-3
>  >  trellis.device(theme="col.whitebg")
>  >  xyplot(as.formula(paste(tmp00[2*i], "~ ", tmp00[(2*i)-1],
> +                             "|Blastomere+Phenotype", sep="")),
> +         data=tmp1,
> +         panel=function(x,y,...){
> +           panel.xyplot(jitter(x), jitter(y), pch=16, col="red") if
> +           (max(x, na.rm=T)!=0.0) panel.xyplot(x, y, type="r",  
> lwd=2)
> +        })
>  >
> 
> BUT, when I stick this in a loop, I get a bunch of blank graphics 
> devices. This happens even if the loop only executes once. I could 
> just go through and do these one by one, but I was curious if I was 
> overlooking something obvious. Thank you for any advice.
> 
> ==================================================================
> George W. Gilchrist                        Email #1: gwgilc at wm.edu
> Department of Biology, Box 8795          Email #2: kitesci at cox.net
> College of William & Mary                    Phone: (757) 221-7751
> Williamsburg, VA 23187-8795                    Fax: (757) 221-6483
> http://gwgilc.people.wm.edu/
> 
> ______________________________________________
> 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

Petr Pikal
petr.pikal at precheza.cz




More information about the R-help mailing list