Adding greek character to axis title

Rita picture Rita · May 18, 2011 · Viewed 97.5k times · Source

I want to add a greek character to the y-axis of my barplot in R.
The problem is that I need this character to be integrated in the title. I want to write:

Diameter of aperture ("mu"m)

in the axis label.

With

ylab=expression()

I can write the greek character, with

ylab="axis title"

I can write the title with proper spaces between the words.

But I can't find a way to put all these together and write a proper label with a greek word in the axis label. I hope I was clear enough.

Answer

Nick Sabbe picture Nick Sabbe · May 18, 2011

If you're using plotmath{grDevices}, the main help page (plotmath) contains an example of what you appear to want:

xlab = expression(paste("Phase Angle ", phi))

or for your case, I guess:

ylab = expression(paste("Diameter of aperture ( ", mu, " )"))

Does this work for you?