user13317
user13317

Reputation: 505

Adding a prime symbol to greek letter in ggplot2

I want to annotate a ggplot2 graph with lambda' or in LaTex speak $\lambda^{\prime}$, but this will not parse in R

parse(text='lambda"\'"')
Error in parse(text = "lambda\"'\"") : 
  <text>:1:7: unexpected string constant
1: lambda"'"

Does anybody know how to do this? I think this is why ggplot throws an error to

annotate('text',x=x,y=y,label='lambda"\'"',parse=TRUE)

Upvotes: 1

Views: 1048

Answers (1)

joran
joran

Reputation: 173577

You could try this:

ggplot(mtcars,aes(x = mpg,y = wt)) + 
    geom_point() + 
    annotate("text",x = 10,y = 5,
             label = "lambda*minute",size = 6,parse = TRUE)

Upvotes: 3

Related Questions