R-alpha: various graphics Q.

Ben Bolker ben@eno.Princeton.EDU
Mon, 23 Jun 1997 12:47:50 -0400 (EDT)


  "contour" can't return a list of contours (it would be nice)

  "arrows" has different options from S-PLUS (no "open" or "rel" options,
no "lwd" parameter or graphics parameter pass-through; "size" in S
corresponds to "length" in R).  [I know we needn't follow S-PLUS syntax
slavishly, but it would be nice at least to compile a more-or-less
comprehensive list of differences.]

   The xaxs option "i" (no extra space around xlim, ylim) isn't documented

   axis() first argument is called "side" (not "which" as in S: see
comment above)

In lines 5-8 I correct what I think is a bug -- since "cra" (character
size in rasters)  doesn't change with "cex", the legend line-spacing
doesn't change correctly for cex>1.
   The other changes, which should definitely be considered optional, adds
the capability I've always wanted in legends -- to be able to mix symbols
and lines in the same legend without having to have a symbol or a line for
every item in the legend, and to be able to put symbols and lines in the
same column (option "merge").  The spacing's not quite perfect, though.

3c3
< 	xjust=0, yjust=1, merge=FALSE, ...)
---
> 	xjust=0, yjust=1, ...)
5,8c5,8
< 	xchar <- xinch(par("cin")[1])*par("cex")
< 	ychar <- yinch(par("cin")[2])*1.2*par("cex")
< 	xbox <- xinch(par("cin")[2]*0.8)*par("cex")
< 	ybox <- yinch(par("cin")[2]*0.8)*par("cex")
---
> 	xchar <- xinch(par("cin")[1])
> 	ychar <- yinch(par("cin")[2]) * 1.2
> 	xbox <- xinch(par("cin")[2] * 0.8)
> 	ybox <- yinch(par("cin")[2] * 0.8)
50c50
< 		if (!merge) xt <- xt + xbox + xchar
---
> 		xt <- xt + xbox + xchar
52d51
< 	col _ rep(col,length.out=length(legend))
54,57c53,54
< 	    pch _ rep(pch,length.out=length(legend))
<                 ok _ (is.character(pch) | pch>0)
< 		points((xt + 0.25 * xchar)[ok], yt[ok], pch[ok], col=col[ok])
< 		if (!merge) xt <- xt + 1.5 * xchar
---
> 		points(xt + 0.25 * xchar, yt, pch, col=col)
> 		xt <- xt + 1.5 * xchar
60,66c57,58
< 	    lty _ rep(lty,length.out=length(legend))
<                 ok _ (lty>0)
< 	        if (merge) segments((xt-xchar)[ok], yt[ok], (xt + xchar)[ok],
< 			yt[ok], lty=lty[ok], col=col[ok])
< 		else segments(xt[ok], yt[ok], (xt + 2 * xchar)[ok],
< 			yt[ok], lty=lty[ok], col=col[ok])
< 		if (!merge) xt <- xt + 3 * xchar
---
> 		segments(xt, yt, xt + 2 * xchar, yt, lty=lty, col=col)
> 		xt <- xt + 3 * xchar
68d59
<         if (merge) xt <- xt + 3 * xchar



=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
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
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-