Adding greek character to axis title
I think I followed your question properly. The ~
forces a space between characters in a call to expression()
. Is this what you want?
plot(1:3, ylab = expression("Diameter of apeture (" * mu ~ "m)"), , xlab = expression("Force spaces with ~" ~ mu ~ pi * sigma ~ pi) , main = expression("This is another Greek character with space" ~ sigma))
And if you want to substitute variables in the text, use bquote
. For instance, if you have a variable mu
and want to show it in the title, then use the following idiom:
mu <- 2.8plot(1:3, main=bquote(mu == .(mu)))
The part enclosed in .()
will be substituted, so that the value of mu
will be printed and not the greek "mu" character. Consult the R help on bquote
for details.