[R] Clipping of display in Lattice graphics
Matthew Walker
m.g.walker at massey.ac.nz
Thu Aug 19 13:38:31 CEST 2004
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)
pushViewport(vp)
grid.rect(gp=gpar(fill="white"))
grid.xaxis()
grid.yaxis()
grid.points(x,y)
grid.line(x,y)
If you run this you will see a datapoint and line extend into the pink area.
However, if xyplot is used, it doesn't extend past its borders:
xyplot(y~x, xlim=c(0,1), ylim=c(0,1), type=c("p","l"))
From what I understand so far:
xyplot calls panel.xyplot
panel.xyplot calls lpoints and llines
neither lpoints nor llines do much except call xy.coords and then call
lplot.xy
lplot.xy calls grid.points and grid.lines
Where in this code does the clipping occur? I'm quite baffled really.
Thank you for considering this,
Matthew
More information about the R-help
mailing list