I am trying to make a y-axis title with both a special character and a superscript. I am able to do this, but I want the closing parentheses not to be superscripted. And that's what I'm having a problem with. I think its just a placing of my parenthesis, but I've tried (seemingly) everything.
plot(WatexCl, ConcuM, col = as.numeric(1), pch = as.numeric(Depth),
xlab = expression(paste("Concentration Cl ( ", mu, "moles/g dry wt)")),
ylab = expression(paste("Average Conc of S- on plates ( ", mu, "Moles/cm"^"2"),)),
data = plates)
This solves the problem of the super-scripted closing parenthesis:
The one thing that often users fail to grasp is that you invariably don't need to quote strings and
paste
them together when used in an expression for a plot label. It is usually simpler to use the layout tools directly (e.g.~
and*
). For example:Alternatively, you can include strings for longer sections of text; in this case it is arguably easier to do:
but note there is no need to
paste
strings and other features here.Both produce:
Note the issue plotmath has with the superscript 2. You may wish to add some extra space for the y-axis margin to accommodate that:
producing