0

I need to print the temperature symbols with ggplot2. How could I do this?

This is my example code:

library(ggplot2)
df <- data.frame(x = 1:10, y = 1:10)
p <- ggplot(df)
p <- p + geom_point(aes(x, y))
p <- p + annotate('text', x = 5, y = 5, 
        label = expression('Temperature ('*degree*'C)'))
p <- p + annotate('text', x = 5, y = 6, 
        label = 'Temperature')
p

But "degree" symbol cannot show in the figure. How should I fix it? Thanks for any suggestions.

Bangyou
  • 8,880
  • 14
  • 59
  • 90

0 Answers0