[R] superscript text on graph legend

Gavin Simpson
Sun, 11 May 2008 16:25:27 -0000

On Sun, 2008-05-11 at 09:58 -0400, Agus Susanto wrote:
> Is that possible to create superscript text on the graph legend, for
example
> to put "cm2" (centimeter square) on the legend. Please show me
how to do it.
> Thanks.

Here is one way, showing super and subscripts. The key bit is the
expression(paste(....)) sections.

> datx <- runif(10)
> daty <-rt(10, 3)
> plot(daty ~ datx, ann = FALSE)
> title(xlab = expression(paste(NO[3], " Concentration")),
+ ylab = expression(paste("Area (", cm^2, ")", sep =
"")))

HTH

G

--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
 Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%