aaron
aaron

Reputation: 6489

How to add a superscript while plotting a measurement unit in R?

I wish to add a label: kgC/m^2/month to y axis of a plot in R with ^2 being displayed as superscript on m.

Upvotes: 0

Views: 946

Answers (1)

bnjmn
bnjmn

Reputation: 4584

plot(..., ylab = expression(kgC/m^2/month) )

You may also want to try frac for fractions (but this doesn't always work great for axis labels)

plot(..., main = expression( frac(kgC,m^2)/month) )

Additionally, use ?plotmath to visit help on mathematical annotations or demo(plotmath) to run through a series of examples that demonstrate the source and output for many common mathematical expressions.

Upvotes: 3

Related Questions