[R] legend(): how to put variable in subscript?
Aleksey Naumov
naumov at buffalo.edu
Sat Apr 30 22:28:24 CEST 2005
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.
Aleksey
--
Aleksey Naumov
Department of Geography
SUNY-Buffalo
More information about the R-help
mailing list