[R] Clipping of display in Lattice graphics

Deepayan Sarkar deepayan at stat.wisc.edu
Thu Aug 19 16:14:29 CEST 2004


On Thursday 19 August 2004 06:38, Matthew Walker wrote:
> I'm baffled as to how the Lattice package achieves clipping.  Would
> someone mind explaining this to me?
>
> Firstly, my attempt using "just" the grid package:
>
> x<-seq(0,3,by=0.3)/2.8
> y<-seq(0,1,by=0.1)
>
> grid.newpage()
> grid.rect(gp=gpar(fill="pink"))
>
> vp<-viewport(width=0.8, height=0.8)

You need to add 'clip="on"' here. Clipping is a property of viewports 
(not individual 'grob'-s as produced by grid.points and grid.lines),  
controlled by the 'clip' argument to viewport(). Details (and caveats) 
in ?viewport.

Hth,

Deepayan




More information about the R-help mailing list