Symbols and superscript/subscripts in axis labels

5,814 views
Skip to first unread message

waschbaer

unread,
Mar 29, 2011, 11:17:47 PM3/29/11
to ggplot2
Hi @all

I would like to have a symbol and some sub- and superscripts in my y-
axis labels. Any idea how to solve that? The label should look like:

d15N-NO3 (%0) which means the delta 15 N isotopic ratio of NO3 in per-
mille.

Any suggestions are greatly appreciated.

Cheers
Martin

waschbaer

unread,
Mar 29, 2011, 11:18:30 PM3/29/11
to ggplot2

Dennis Murphy

unread,
Mar 29, 2011, 11:56:13 PM3/29/11
to waschbaer, ggplot2
Hi:

I know little about chemistry so the expression may end up as nonsense, but it's an excuse to show how to use subscripts and superscripts in an expression. See ?plotmath for a list of operators and a useful example.

df <- data.frame(x = 1, y = 1)
ggplot(df, aes(x, y)) + geom_point() + xlab(expression(paste(delta^{15},'N-N',O[3]~'(%0)')))

paste() is used here to separate the mathematical parts of the expression from the text parts; the tilde represents insertion of space.

HTH,
Dennis


--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: http://gist.github.com/270442

To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+u...@googlegroups.com
More options: http://groups.google.com/group/ggplot2

waschbaer

unread,
Mar 30, 2011, 2:30:13 AM3/30/11
to ggplot2
Thanks for that...that works like a charm.

Martin

Katya Hafich

unread,
Oct 22, 2013, 1:09:25 PM10/22/13
to ggp...@googlegroups.com
I'm using this code, but would like to make the 0 in the (%0) subscript, so it would read  (‰).  Any suggestion? Thanks.
Reply all
Reply to author
Forward
0 new messages