[R] Trellis graphics and clipping
deepayansarkar at yahoo.com
Sun Jul 29 18:34:53 CEST 2001
The problem lies (if I get you correctly) in the fact
that Lattice graphics devices need to be initialized
differently from usual R graphics devices. This has to
do with special requirements of the underlying grid
package, and also some standard parameter settings
associated with each device.
Upshot: you need to use
trellis.device(postscript, file = "filename.ps")
What this does (with regard to clipping) is that it
calls a grid function grid.start(). You can get almost
the same effect if you do
but trellis.device is the preferred way. The same goes
for the x11() device.
I would encourage you to read the ?Lattice help page
to familiarise yourself with this sort of
Note: Currently, usual R graphics and lattice/grid
graphics don't mix, that is, you have to enclose any
calls to grid graphics functions (which includes all
lattice graphics functions) within calls to
grid.start() and grid.stop(). Hopefully, this will
change somewhat in the next release of lattice.
--- Ted.Harding at nessie.mcc.ac.uk wrote:
> Hi again folks,
> I seem to have got the trellis (lattice + grid)
> working basically OK, in that I can get my 5x5 array
> histograms laid out as they should be.
> However, there is a behaviour I can't see my way
> Even when displayed in the R Graphics Window, there
> some clipping (the extreme top, bottom, left and
> edges are not there, so that labels, and parts of
> scale markers all round, have been clipped off).
> When I switch to the "postscript" device, with the
> 'postscript(filename,...)', the result is even more
> in that parts of the histogram plots themselves get
> cut off,
> including their titles as seen in the X11 display.
> On the
> other hand (using gv's "position meter"), it seems
> that the
> internal %%BoundingBox matches the dimensions and
> of what SHOULD get displayed/printed, allowing
> plenty of
> "white space" round the bit of the graphic that
> _does_ get
> displayed, so that the whole thing could have been
> fitted in
> And if I go at it crudely, simply using
> 'dev.print()' to
> bang out a har-copy, it is even more clipped again
> I've tried playing with all the obvious (to me)
> which I can find, but it has not effect on this.
> I've checked the PostScript file itself, and the
> parts that
> are missing are not mentioned therein, so it's not a
> "clippath" phenomenon: it's definitely R which is
> deciding not
> to output them.
> What's needed is some way of coordinating the
> dimensions of
> the various levels of this process, so that the
> output to X11
> is scaled so that the whole graphic can fit in, and
> the output
> to postscript is also scaled so that it fits into
> size of graphic is nominated (not that this should
> be an
> issue for EPS output anyway -- it would be quite
> to output everything and then put a BoundingBox
> round the
> lot, and never mind things like papersize and so
> So I'm bewildered. And, if anyone knows a way round
> I'd be most obliged to hear!
> With thanks,
> E-Mail: (Ted Harding) <Ted.Harding at nessie.mcc.ac.uk>
> Fax-to-email: +44 (0)870 167 1972
> Date: 29-Jul-01
> Time: 13:40:47
> ------------------------------ XFMail
> r-help mailing list -- Read
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !) To:
> r-help-request at stat.math.ethz.ch
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
More information about the R-help