[R] More problems with lattice and postscript

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Jun 24 11:47:14 CEST 2004


On Thu, 24 Jun 2004, Virgilio Gómez Rubio wrote:

> I am trying to produce some trellis graphics and to save them in a
> postscript file but I only get blank files. R behaviour is certainly
> strange because I use a loop to generate the graphics (see code below).
> When I change the loop variable myself the postscript graphics are OK.
> 
> I am using R 1.9.1 (2004-06-21) on Debian GNU/Linux which I try to keep
> updated on a daily basis. I am aware of some problems in R 1.9.0 but
> I don't know if it has been fixed yet.

It has.  See the NEWS file.

> And nobody mentioned problems with loops.

They are mentioned frequently.  You have to explicitly print lattice 
plots, such as bwplot.  See ?Lattice.

> Any ideas? Thanks in advance.
> 
> Best regards,
> 
> Virgilio
> 
> 
> 
> for(centre in 1:3)
> {
>         for(method in 1:12)
>         {
> 
>                 auxdata<-
>        
> as.data.frame(t(table.thres[c(method,16),1+(centre-1)*250+(1:250)]))
> 
>                 names(auxdata)<-c("Threshold", "Parameters")
> 
>                 trellis.device(postscript,
> file=paste("plots/thresold-",method,"-",centre,".eps", sep=""),
> onefile=FALSE, color=TRUE)
> 
> 
>                 bwplot(Threshold~Parameters, data=auxdata,
> groups=Parameters,
>                         main=list(label=get.method(method), cex=1.5),
>                         horizontal=FALSE, pch=".", scales=list(cex=1.5),
>                         par.strip.text=list(cex=1.5))
>                 dev.off()
>         }
> }

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list