[R] [Q] use of expression() in plot() vs. hist()
Peter Dalgaard BSA
p.dalgaard at biostat.ku.dk
Thu Feb 18 19:41:52 CET 1999
George White <gwhite at bodnext.bio.dfo.ca> writes:
> > First of all, I don't know where people are getting that paste()
> > construction from. The juxtaposion operator for plotting math is "*",
> > i.e.
> >
> > hist(c(0,0,0,0,4,5,6,6,6,8), xlab=expression("scaled "*rho))
> >
> The use of "paste" comes from careful reading of the documentation:
>
> > ?legend
> [...]
> ex.cs1 <- expression(plain(sin) * phi, paste("cos", phi))# 2 ways
> legend(-3, .9, ex.cs1, lty=1:2, col=2:3)
>
> "paste" and "*" are both used in "?text" as well.
I might have checked....
Anyways, there's clearly a bug in the implementation of paste(), so
'*' should be used for now.
Specifically:
static BBOX RenderConcatenate(SEXP expr, int draw)
{
BBOX bbox;
int i, n;
expr = CDR(expr);
n = length(expr);
for (i = 0; i < n; i++) {
bbox = CombineBBoxes(bbox, RenderElement(CAR(expr), draw));
if (i != n - 1)
....
starts with an uninitialised bbox, which looks unhealthy to me.
--
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help 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-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list