0

I want to add a ggtitle for my chart which contains Greek characters: "Rate (kΩ)". I also want to label the legend appropriately as "kΩ", presumably using labs().

I found this question, which seemingly discusses use for every plot section except the ones above. Is this possible?

Margaret
  • 5,749
  • 20
  • 56
  • 72
  • 1
    You can use `expression()` for any of the arguments to `labs()`, of which `title=` is one. – Brian Jan 04 '18 at 02:35
  • 2
    `ggplot(mtcars, aes(wt, mpg, color=factor(cyl))) + geom_point() + ggtitle(expression(Rate~k*Omega)) + labs(x=expression(k*Omega), colour=expression(k*Omega)) `. – eipi10 Jan 04 '18 at 03:02

1 Answers1

2

What I would do is to use labsto label both your main title, and your legend. It's probably personal preference, but I do find it just a bit tidier.

Eipi mentioned about expression and he's right, all you needed was to wrap that part of the code in brackets to get what you asked for: Rate (kΩ)

The full code would be something like this:

ggplot(smr, aes(Fuel.Rate, Eng.Speed.Ave.)) + 
  geom_point() + 
  labs(title=expression(Rate~(k*Omega)), x=expression(k*Omega))

enter image description here

onlyphantom
  • 8,606
  • 4
  • 44
  • 58
  • Nice answer. For a unicode solution, see: https://stackoverflow.com/questions/27690729/greek-letters-symbols-and-line-breaks-inside-a-ggplot-legend-label – PatrickT Dec 07 '18 at 10:06