user507 user507 - 1 month ago 9
R Question

Superscript, subscript, and greek symbol all in one axis title in ggplot2

I have the following title which I need for an axis for my plot in ggplot2:
Plant δ34S (%0).

I'm unsure how to format it so that it appears properly in this question, but I need the 34 as as a superscript and the zero as a subscript. Therefore, I need a greek symbol, a superscript, and a subscript all in one axis title.

Although I know of various ways to code using expression, bquote, paste, etc, I've had little luck incorporating all three of these special cases. Any tricks to coding this properly?

Answer

Try this:

plot(0, xlab = ~ paste("Plant ", delta ^ 34, "S ", ("%"[0])))

screenshot