Re: [S] More on the trellis question

Prof Brian Ripley (ripley@stats.ox.ac.uk)
Wed, 11 Mar 1998 07:52:03 +0000 (GMT)


Patrick Connolly wrote:
>
> According to Bill Venables:
> |>
> |> Instead of
> |>
> |> trellis.device(postscript, file = psFile)
> |>
> |> in your function, try
> |>
> |> eval(substitute(trellis.device(postscript, file = psFile)))
> |>
> |> this essentially makes evaluation a little less lazy, probably by
> |> about as much as you need.
>
> What also works is to assign your psFile to frame 1. I do that sort
> of thing often and have a small function to do it:
>
> assign(as.character(substitute(x)), x, frame = 1)
>
> I noticed that functions which had worked in Ver 3.3 needed this
> tweeking to work in Ver 3.4, but even so, it was not always necessary.
>
> It was easier to add one line to assign the object than to work out
> why it was necessary some times and not others.
>

In view of the subsequent comments, here is part of my private reply to
Richard E. Higgs Jr, who posted:

> What I'm exactly interested in doing is creating a function called foo(inFile,
> psFile) where inFile is a text data file I want to analyze/plot and psFile is
> the name of the postscript file that foo() creates. I don't want foo() to
> print the file, just create it. I have no problems using the postscript()
> command with it's various arguments. However, when my output plot of interest
> contains a hexagonal binning plot, much better graphics output is obtained by
> using trellis.device().

That cannot be so, as trellis.device() just calls postscript with various
options! I think you just need to fathom out which options you like.
It is probably one of

color=bwps.trellis, black.and.white="false"

and probably the first.

> Does trellis.device() require some type of object (other than a character
> string) for the file parameter?
>
No, but the object does need to be visible. If you are doing this inside
a function, you need to assign psFile in frame 1.

As we were told that psFile is already a character string, all that
is needed is

assign("psFile", psFile, f=1)

-- 
Brian D. Ripley,                  ripley@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 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu.  To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message:  unsubscribe s-news