Use superscripts in R axis labels
Solution 1:
It works the same way for axes: parse(text='70^o*N')
will raise the o
as a superscript (the *N
is to make sure the N doesn't get raised too).
labelsX=parse(text=paste(abs(seq(-100, -50, 10)), "^o ", "*W", sep=""))
labelsY=parse(text=paste(seq(50,100,10), "^o ", "*N", sep=""))
plot(-100:-50, 50:100, type="n", xlab="", ylab="", axes=FALSE)
axis(1, seq(-100, -50, 10), labels=labelsX)
axis(2, seq(50, 100, 10), labels=labelsY)
box()
Solution 2:
This is a quick example
plot(rnorm(30), xlab = expression(paste("4"^"th")))
Solution 3:
@The Thunder Chimp You can split text in such a way that some sections are affected by super(or sub) script and others aren't through the use of *. For your example, with splitting the word "moment" from "4th" -
plot(rnorm(30), xlab = expression('4'^th*'moment'))
Solution 4:
The other option in this particular case would be to type the degree symbol: ˚
R seems to handle it fine. Type Option-k on a Mac to get it. Not sure about other platforms.