[Rd] Incorrect display of b[hat((a))] expression in plots

From: Henrik Bengtsson <hb_at_maths.lth.se>
Date: Wed 28 Jul 2004 - 03:12:14 EST


Hi, I am not sure if this is a bug or a non-implement feature of text-drawing functions with TeX-style expression, but hat() and some of its equals does not get the right "bounding boxes" if they are put in sub- or superscripts. For instance, for the expression 'b[hat(a)]' the hat() seems to shift 'hat(a)' too much to the right of 'b'. Try the below example and you'll see what I mean:

label <- list(
  expression((b[sqrt(a)])),
  expression((b[bar(a)])),
  expression((b[widehat(a)])),
  expression((b[widetilde(a)])),
  expression((tilde(a))),

  # Problematic:
  expression((b[dot(a)])),
  expression((b[ring(a)])),
  expression((b[hat(a)])),
  expression((b[tilde(a)])),
  expression((b^dot(a))),
  expression((b^ring(a))),
  expression((b^hat(a))),
  expression((b^tilde(a)))

)

plot(NA, xlim=c(0,2), ylim=c(-1,length(label))) for (kk in seq(label))
  text(1,length(label)-kk, label=label[[kk]])

The problem occurs for the postscript and png devices too (I haven't tried the others).

I'm on WindowsXP and "R version 1.9.1, 2004-06-21" (non-patched).

Best wishes

Henrik Bengtsson

Dept. of Mathematical Statistics @ Centre for Mathematical Sciences Lund Institute of Technology/Lund University, Sweden (+2h UTC) +46 46 2229611 (off), +46 708 909208 (cell), +46 46 2224623 (fax) h b @ m a t h s . l t h . s e, http://www.maths.lth.se/~hb/



R-devel@stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-devel Received on Wed Jul 28 03:18:25 2004

This archive was generated by hypermail 2.1.8 : Fri 18 Mar 2005 - 08:59:14 EST