I want to generate dynamically a subscript for a text in a plot with an R expression. The text of the three points in the plot below should be $\pi_1$
, $\pi_2$
, and $\pi_3$
.
lbs <- vector()
for(i in 1:3) lbs <- append(lbs, expression(pi[i]))
plot(1:3)
text(1:3, labels=lbs)
The Greek letter appears, but the subscript remains as i
. I've tried bquote
as well but without success.
I appreciate any suggestions.