[Rd] abline() AND rect() do not obey "xpd" (clipping) (PR#750)

maechler@stat.math.ethz.ch maechler@stat.math.ethz.ch
Wed, 29 Nov 2000 14:02:51 +0100 (MET)


>>>>> "MM" == Martin Maechler <maechler@stat.math.ethz.ch> writes:

    MM> This is not a bug in the very strict sense,
    MM> but for consistency,  
    MM> I feel that
    MM> abline() 
    MM> should obey  par("xpd") setting, even by ...-argument.
    MM> The following code shows how  lines() ``works'' and abline() does not :

    MM> par(mfrow=c(2,1))
    MM> plot(1:4)
    MM> plot(1:10)
    MM> par(xpd=NA); abline(v=1:10); par(xpd=FALSE)
    MM> ## or even
    MM> abline(v=1:10, xpd = NA, col = "purple")
    MM> ## lines() *does* work with xpd arg:
    MM> lines(4:5,c(1,40), col = 2, xpd = FALSE)# clip to plot
    MM> lines(5:6,c(1,40), col = 3, xpd = TRUE)# clip to figure
    MM> lines(6:7,c(1,20), col = 4, xpd = NA)# clip to device 
    MM> text(4:6, 10.5, "xpd =", xpd = TRUE, col = 2:4)
    MM> text(4:6, 10, c("FALSE","TRUE","NA"), col = 2:4, adj = 0)

Also, 
      rect() 
fails similarly.
This gives funny legend()s :

 plot(1:10)
 legend(1,7.5,  c("1st", "2nd", "third"), col = 1:3, lwd = 1:3, pch = 1:3)
 op <- par(xpd = NA)
 legend(1,11.5, c("1st", "2nd", "third"), col = 1:3, lwd = 1:3, pch = 1:3)
 ## pch = 1 also doesn't ?!?? ?? why??  It does here :
 points(2+ 1:8, rep(11, 8), pch = 1:8, col = "purple")
 ## and other pch's do here
 legend(4,11.9, c("1st", "2nd", "third"), col = 1:3, lwd = 1:3, pch = 6:4)
 par(op)

## Note that there seems another peculiar clipping bug 
##       with pch = 1 in legend

Martin Maechler <maechler@stat.math.ethz.ch>	http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum  LEO D10	Leonhardstr. 27
ETH (Federal Inst. Technology)	8092 Zurich	SWITZERLAND
phone: x-41-1-632-3408		fax: ...-1228			<><

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel 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-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._