text( col=, cex=, font=) : doesn't allow more than length-1 arg (PR#287)

About this list Date view Thread view Subject view Author view Other groups

Subject: text( col=, cex=, font=) : doesn't allow more than length-1 arg (PR#287)
maechler@stat.math.ethz.ch
Date: Mon 27 Sep 1999 - 19:12:21 EST


Message-Id: <199909270912.LAA27339@pubhealth.ku.dk>

text(..., col = <..>) doesn't work if col has length more than one;

and the same for 'cex' and 'font'

A toy example, showing what is desired

plot(1);text(1.2, .8+(0:5)/16, LETTERS[6:1])
## works alright

plot(1);text(1.2, .8+(0:5)/16, LETTERS[6:1],col=1:6)
##>>> Error in par(args) : parameter "col" has the wrong length

---
Explanation:
The source code is in  src/main/plot.c  in do_text(),
and from reading it, "col" (& "cex" & "font") are extracted via GetPar()
(and later would nicely be recycled).
HOWEVER, the ProcessInlinePars() called after the three GetPar() gives the
error message, because "col" (cex, or font) are still part of the `args'
list.

All boils down to the FIXME part of the following description of GetPar() [around line 120 in plot.c] :

/* GetPar is intended for looking through a list -- typically that bound * to ... -- for a particular parameter value. This is easier than * trying to match every graphics parameter in argument lists explicitly. * FIXME: This needs to be destructive, so that "ProcessInlinePars" * can be safely called afterwards. */

PLEASE, can we fix this!

Idea: don't shorten the `parlist' argument of GetPar(), for efficiency. Just set the TAG to "", such that it will be disregarded subsequently, i.e., do something like

SEXP GetPar(char *which, SEXP parlist) { SEXP w, p; w = install(which); for (p = parlist; p != R_NilValue; p = CDR(p)) { if (TAG(p) == w) { NEW>>> TAG(p) == mkString(""); return CAR(p); } } return R_NilValue; }

-- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b25 : Tue 04 Jan 2000 - 14:16:08 EST