Search code examples
rplotbracketssubscriptsuperscript

Superscript in brackets for my axis title


I made a boxplot with boxplot() and I have a superscript in my y-lab labeling. It looks like this: ylab = expression(paste("spleen volume cm"^3))

Now I want the "cm3" with the superscript of "3" in brackets [cm^3].

I tried this:

ylab = expression("spleen volume " (paste("[cm"^3, "]")))

but unfortunately the whole thing is in () too, how can i remove these "()" around it? here is how it looks like right now

Unfortunately I am failing, can anyone help?

Kind regards!


Solution

  • Try

    xlab = expression(paste("spleen volume [cm"^3, "]"))
    

    enter image description here