You appear to be using lattice commands to plot on a postscript device:
you should be using a trellis.device.
Also, you do need to *print* lattice commands, and I guess you are
not doing so in the custom commands which you are not showing us.
Wre those calls to zyplot, they would not work unless surrounded by
print().
Please be careful to distinguish the use of lattice from `plotting',
as the details are where I suspect the problem arises.
On Tue, 28 Jan 2003, Marco Albani wrote:
> Hello,
>
> I am having problems with plotting to a postscript device within a
> function call.
>
> When I do the same thing line by line in the command line interface, I
> have no problems, but the function creates an empty postscript file.
> If I remove the dev.off() call at the end of the function, I get one of
> the plots (the last), but not the others.
>
> Is there any way to get around this problem, or a better way to have R
> plot a series of diagnostic graphics from a dataframe with a singe
> command? Sounds like a general enough problem, but I have found no
> answers with my Google searches
>
> R.version:
> platform i686-pc-linux-gnu
> arch i686
> os linux-gnu
> system i686, linux-gnu
> status
> major 1
> minor 5.0
> year 2002
> month 04
> day 29
> language R
>
> the function is
>
> BbEh.graphs2eps <- function(the.data){
>
> #function to plot all sort of information to
> #a single eps file for storage and future printing or display
> #does not work because of laz evaluation?
>
> filename <- deparse(substitute(the.data))
> thefile <-
paste(c("../ed/",filename,"/",filename,".eps"),collapse
= "")
> postscript(file= thefile, paper = "letter")
> lset(my.lts)
>
> #plot cohort variables
> BbEh.xyplot.dbh(the.data) #these are custom lattice plotting functions
> BbEh.xyplot.h(the.data)
> BbEh.xyplot.bl(the.data)
> BbEh.xyplot.bs(the.data)
> BbEh.xyplot.dens(the.data)
>
> #plot allometry checks
> BbEh.xyplot.hVSdbh(the.data)
> BbEh.xyplot.bdVSdbh(the.data)
> BbEh.xyplot.blVSdbh(the.data)
> BbEh.xyplot.bdVSh(the.data)
>
> dev.off(dev.cur())
>
>
> }
>
>
--
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