1 May 2005 09:25
Re: [R] legend(): how to put variable in subscript?
Peter Dalgaard <p.dalgaard <at> biostat.ku.dk>
2005-05-01 07:25:14 GMT
2005-05-01 07:25:14 GMT
Aleksey Naumov <naumov <at> buffalo.edu> writes: > Dear List, > > I would like to plot a simple legend with two math expressions, e.g. > > plot(0) > legend(1, 0.5, expression(sigma[i], sigma[j])) > > The difficulty is that i and j should be variables rather than strings "i" and > "j". In other words I'd like to do something like: > > i = "A" > j = "B" > legend(1, 0.5, expression(sigma[i], sigma[j])) > > and have "A" and "B" as the actual subscripts. I can substitute the variable > in the expression e.g.: > > legend(1, 0.5, substitute(sigma[i], list(i='A', j='B'))) > legend(1, 0.5, bquote(sigma[.(i)])) > > however, this gives me just one of the two entries in the legend. I cannot > figure out how to include both sigmas in the legend. > > What would be the best way to do something like this? Thank you for your ideas > or suggestions. Ick. One of those cases that suggests that our current substitute mechanisms don't quite cut it... However, try(Continue reading)
RSS Feed