[R] Plot label axis with expression

Noia Raindrops noia.raindrops at gmail.com
Wed Aug 22 23:46:49 CEST 2012


Hello,

Use 'parse' for converting from character to expression:

x <- c(100, 50, 10, 1, 0.1, 0.05, 0.001)
plot(log(x), yaxt = "n")

parse(text = sprintf("e^%d", axTicks(2)))
## expression(e^-6, e^-4, e^-2, e^0, e^2, e^4)

axis(2, at = axTicks(2), labels = parse(text = sprintf("e^%d", axTicks(2))), las = 1)

-- 
Noia Raindrops
noia.raindrops at gmail.com




More information about the R-help mailing list