Skip to content
Prev 27728 / 63424 Next

Clipping using par(plt=..., xpd=FALSE) inconsistencies

I think you misunderstand what par("plt") is supposed to do.  The 
documentation says

      'plt' A vector of the form 'c(x1, x2, y1, y2)' giving the
           coordinates of the plot region as fractions of the current
           figure region.

You haven't subsequently made a new plot, so why do you expect the 
clipping region to be changed to that you indicated for the next plot?

I'd say the bug was that box() changed it, and that happens because it 
internally sets xpd and so resetting xpd sets the clipping region next 
time it is used.  Because of

void GClip(pGEDevDesc dd)
{
     if (gpptr(dd)->xpd != gpptr(dd)->oldxpd) {
 	double x1, y1, x2, y2;
 	setClipRect(&x1, &y1, &x2, &y2, DEVICE, dd);
 	GESetClip(x1, y1, x2, y2, dd);
 	gpptr(dd)->oldxpd = gpptr(dd)->xpd;
     }
}

Maybe we should have user-level code to set the clipping region?
On Fri, 22 Feb 2008, Greg Snow wrote: