Itai Granot
Itai Granot

Reputation: 45

superscription of only one character within brackets on an axis label in ggplot

I want my x label to be: Latitudinal extent(0), with the zero inside the brackets superscript (i.e. the degrees symbol). I can't find a way of doing it.

Currently, this works:

xlab(expression(Latitudinal~extent~(.^0~.)))

but then I need to erase the extra dots using Paint (or something similar).

Upvotes: 1

Views: 199

Answers (1)

Roland
Roland

Reputation: 132969

If you want the degree symbol, why don't you use the degree symbol?

plot(1, xlab = expression("Latitudinal extent"~(degree)))

A superscript zero is possible but doesn't look good:

plot(1, xlab = expression("Latitudinal extent"~({}^0)))

You might want to study help("plotmath").

Upvotes: 1

Related Questions