Using base graphics in R, how can I add superscripts to axis labels, as one might want to when plotting latitude and longitude axes on a map.
Consider this example:
plot(-100:-50, 50:100, type="n", xlab="", ylab="", axes=FALSE)
axis(1, seq(-100, -50, 10), labels=paste(abs(seq(-100, -50, 10)), "o", "W", sep=""))
axis(2, seq(50, 100, 10), labels=paste(seq(50,100,10), "o", "N", sep=""))
box()
Produces a nice frame around a map. It would be even nicer to make the degree symbol superscript.
This can usually be done in other plotting functions such as mtext()
and text()
using expression(paste(...))
or substitute()
but how to do it in this case?