Nigel Stackhouse
Nigel Stackhouse

Reputation: 364

Adding Special Characters to a plot in R

I need to add a special character to a plot in R. The character that I need to add is the letter 'o' with a dash over it (ō). How can I do this? If I wanted to add the character μ to my plot (as in this question), I can type "mu". But what do I type for o-bar (I'm wishing for a repository of special characters in R)?

Upvotes: 2

Views: 2937

Answers (1)

s_scolary
s_scolary

Reputation: 1399

Try combining expression with the bar function

plot(1:5,main = expression("This is your Special Character -" ~ bar(o)))

Plot 1

Just to add a little more information, R actually lets you do a lot of cool stuff with plotting symbols. check out ?bar.

Just some examples you can try by replacing your argument in main, xlab or ylab:

main = expression(sum(x[i], i==1, n))

main = expression(integral(f(x)*dx, a, b))

Upvotes: 4

Related Questions