[R] math symbols in plot legend

Ott Toomet siim at obs.ee
Wed May 8 09:11:56 CEST 2002


Hi,

I have tried to include a description into legend which includes
mathematical symbols and actual values.  Basically, I want something like

> legend(0.5,1,
	legend=c(expression(gamma==0.2), 
		expression(gamma==1), 	
		expression(gamma==5)), 
	lty=1:3)

Where gamma should be the greek letter.

The problem is that the actual numeric values can change and the number of
expressions can change too.  I have tried to build a vector of expressions
something like

  leg <- NULL
  for(i in seq(along=g)) {
    leg <- c(leg, substitute(expression(gamma==gam), list(gam=g[i])))
  }

but this results into a list and not vector of expressions (however,
component expressions are correct).  My attempts to
convert it with as.expressions() and similar are not been fruitful so long.

I am using R 1.4.0 on linux.

Any suggestions?

Ott Toomet

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