text that combines math expressions and numeric variables
Hi
PROBLEM 1: How can I create expressions that mix mathematical notation,
numeric variables, and ordinary text. For example,
B0 <- 20; B1 <- .25
plot(0:100, 0:100, type="n")
text(30, 90, substitute(hat(beta)[0] == this, list(this=B0)) , adj=0)
#Text1
text(25, 90, "Text 1", adj=1)
text(30, 70, paste("beta.0 =", B0, "and beta.1 =", B1), adj=0) #Text2
text(25, 70, "Text 2", adj=1)
text(30, 50, substitute(hat(beta)[0] == this + hat(beta)[1] == that,
#Text3
list(this=B0, that=B1)), adj=0)
text(25, 50, "Text 3", adj=1)
Text1 plots the combination of math notation and a numeric variable but it
does not contain ordinary text. Text2 shows what I would like to
accomplish, except that I would like replace "beta.1" and "beta.2" with
subscripted greek symbols. Text3 shows something that is almost what I
want, except that I would like to replace the "+" symbol with "and". I am
also puzzled by the fact that mathematical notation plots higher on the
Y-axis than does the corresponding text.
The vertical alignment of the mathematical annotations is wrong -- it should be treating adj=0 as adj=c(0, 0.5). In other words, when a vertical adjustment is not explicitly given, it should centre vertically. At the moment, when a vertical adjustment is not given, it is bottom-adjusting (so to speak) i.e,. it is treating adj=0 as adj=c(0, 0). A work around for this is to use adj=c(0, 0.5) i.e., explicitly specify vertical centring. I will add a proper fix for the next R release. I think there was a similar report about vertical alignment of mathematical annotation on R-help recently. Can anyone confirm/point me to that? Paul -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._