I have the following plot.
plot(0, xlab = '', ylab = '')
For reasons I'm not going to take the time to explain here, I have to use the bquote()
and str2lang()
functions to label the horizontal and vertical axes. Here's what I've tried so far.
Labels <- c('cm^2~hr^-1', '%')
mtext(bquote(.(str2lang(Labels[1]))), side = 1)
mtext(bquote(.(str2lang(Labels[2]))), side = 2)
Why doesn't the '%'
symbol work here? Is there a workaround? Thanks!
If you want to print a literal percent symbol you have to quote it as %
is a "special" character in ?plotmath
:
plot(0, xlab = '', ylab = '')
Labels <- c('cm^2~hr^-1', '"%"')
mtext(bquote(.(str2lang(Labels[1]))), side = 1, line = 3)
mtext(bquote(.(str2lang(Labels[2]))), side = 2, line = 3)