You do not need a second expression()
. In addition, m[2]
gives an index. Use m^2
for superscript.
Here is an example with the mtcars
embedded data mtcars
:
ggplot(mtcars, aes(wt, mpg)) + geom_point() + ylab(expression(paste("eelgrass shoot density", " (shoots/", m^2,")")))
In fact, you donβt even need to use paste
. Instead, you can do this:
ylab(expression(eelgrass~shoot~density~(shoots/m^2)))
where ~
is the space character. If you put actual spaces between words (without using ~
), you will get an error message. However, for readability, you can also do this:
ylab(expression(eelgrass ~ shoot ~ density ~ (shoots/m^2)))
which is equivalent to the code above, since spaces are ignored as long as ~
exists.
In any of the above ylab
expressions, the following graph will be shown:

source share