[R] Lattice barplot not wokring in for-loop?

Romain Francois romain.francois at dbmail.com
Fri Sep 18 11:48:27 CEST 2009


On 09/18/2009 11:44 AM, stvienna wiener wrote:
>
> Dear List-Members,
>
>
> I am plotting a barplot with the lattice package. The code works, but
> when I execute the same code in a for-loop
> no plot is shown. Can't figure what the problem is.
> (Maybe I am missing something here, but I tried it with plot device
> pdf, calling windows() or X11(), testing on windows and linux, etc.)
>
> INFO: R version 2.9.1 (2009-06-26) using Windows/RGui
>
> require(lattice)
>
> for( z in 1:3) {
>
> ## plot works when executed alone,
> ## however in a for loop no plot is shown...
> barchart(yield ~ variety | site, data = barley,
>           groups = year, layout = c(1,6), stack = TRUE,
>           auto.key = list(points = FALSE, rectangles = TRUE, space = "right"),
>           ylab = "Barley Yield (bushels/acre)",
>           scales = list(x = list(rot = 45)))
>
> }
>
>
>
> I can't program any further without solving this.
>
> So, thanks! Really!
> Steve

http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-do-lattice_002ftrellis-graphics-not-work_003f

-- 
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
|- http://tr.im/yw8E : New R package : sos
|- http://tr.im/y8y0 : search the graph gallery from R
`- http://tr.im/y8wY : new R package : ant




More information about the R-help mailing list