unable to add greek letters in ggplot annotate, when either: it is sandwiched in between other text, or the text in question contains an apostrophe.
For example, the following works fine:
df <- data.frame(x = rnorm(10), y = rnorm(10))
temp<-paste("rho == 0.34")
ggplot(df, aes(x = x, y = y)) + geom_point() +
annotate("text", x = mean(df$x), y = mean(df$y), parse=T,label = temp)
However, ggplot explodes when I do:
df <- data.frame(x = rnorm(10), y = rnorm(10))
temp<-paste("Spearman's rho == 0.34")
ggplot(df, aes(x = x, y = y)) + geom_point() +
annotate("text", x = mean(df$x), y = mean(df$y), parse=T,label = temp)
ggplot is frustratingly sensitive to these special characters. Other posts do not appear to address this issue (apologies if not). Thanks in advance.