Skip to content
Prev 25212 / 398502 Next

problem with `legend' + `substitute'

Timur Elzhov wrote:
The structure of your S expression is the point:

  temp <- substitute(paste(Sr["2"], GaMnO["5.541"], 
            ", T = ", T, "K"), list (T = T))
  length(temp)   # ah! 6!
  str(temp)      # that's it! Try also:
  temp[[1]]
  temp[[2]]      # ...
Because it plots one line per element of your S expression, which
consists of 6!
What you can do is:

 x  <-  1
 Te  <- 10
 # substitute at first:
 temp <- substitute(paste(Sr["2"] * GaMnO["5.541"], ",", 
     T == Te * K), list(Te = Te))
 plot(x)
 # and construct a single expression (length = 1) by using do.call():
 legend(1, 1, do.call("expression", list(temp)), 
     bg = "white", xjust = 0.5, yjust = 0.5)

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