I would like to map a sequence of integers to a sequence of expression literals in order to use the latter as tick mark labels in a plot, e.g.
lbls <- lapply(-2:2, function(i) expression(i * pi))
plot(...)
axis(1, at=seq(-2,2)*pi, labels=lbls)
So far I’ve tried all variations of bquote, substitute, expression etc. that I could think of, but apparently I must have missed something.
Also, the FAQ and related SO questions & answers didn’t fully solve this for me.
How would I do it correctly (I want axis to render pi as the greek letter and have -2 … 2 substituted for i in the above example)?
try this: