[R] RE: Trellis graphics and clipping

Uwe Ligges ligges at statistik.uni-dortmund.de
Sun Jul 29 18:18:49 CEST 2001


On Sun, 29 Jul 2001 Ted.Harding at nessie.mcc.ac.uk wrote:

> On 29-Jul-01 Ted Harding wrote:
> > Even when displayed in the R Graphics Window, there is
> > some clipping (the extreme top, bottom, left and right
> > edges are not there, so that labels, and parts of numerical
> > scale markers all round, have been clipped off).
> > [snip]
> > When I switch to the "postscript" device, with the comamnd
> > 'postscript(filename,...)', the result is even more clipped,
> > [snip]
> > I've tried playing with all the obvious (to me) parameters
> > which I can find, but it has not effect on this.
> 
> Follow-up.
> 
> I've tried the following:
> 
>   hgm<-histogram( ~N | B , xlim=x(0,5), layout=c(5,5) , ... )
> 
>   print.trellis( hgm , position=c(0.075,0.075,0.925,0.925) )
> 
> so as to force down-scaling of the graphic, and now everything
> is fully displayed in X11: top and bottom scale annotations,
> bottom label and side label, and all the histograms. No clipping
> whatever. No problems.
> 
> Except that there's an error message:
> 
>   Error in unset.gpar(vps[[1]]$gp) : trying to reset with 10
> 
> Next, I've done
> 
>   postscript(horizontal=FALSE,onefile=FALSE)
> 
> and again
> 
>   print.trellis( hgm , position=c(0.075,0.075,0.925,0.925) )
> 
> (getting the same error message)
> 
> and then looked at the resulting PS file. This is again slightly
> clipped (on the left, as it happens, so that the left label lacks
> the tops of its letters), but everything else is absolutely fine.
> OK,
> 
>   print.trellis( hgm , position=c(0.1,0.1,0.925,0.925) )
> 
> (same error message).
> 
> Now, Lo and Behold, when I view the PS file there is no clipping
> at all. Good!
> 
> So, apart from this error message (which must mean something, but
> nevertheless goes with perfect output) all now seems fine.
> 
> But it still puzzles me that one has to grope for the correct
> "position" parameter settings for each device.
> 
> Is there a way to pull all this together?
> 


Instead of postscript(...) you might want to use

  trellis.device("postscript", ...)


Uwe Ligges

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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 mailing list