I'm using annotate()
to overlay text on one of my ggplot2
plots. I'm using the option parse=T
because I need to use the Greek letter rho. I'd like the text to say = -0.50
, but the trailing zero gets clipped and I get -0.5
instead.
Here's an example:
library(ggplot2)
x<-rnorm(50)
y<-rnorm(50)
df<-data.frame(x,y)
ggplot(data=df,aes(x=x,y=y))+
geom_point()+
annotate(geom="text",x=1,y=1,label="rho==-0.50",parse=T)
Does anyone know how I can get the last 0 to show up? I thought I could use paste()
like this:
annotate(geom="text",x=1,y=1,label=paste("rho==-0.5","0",sep=""),parse=T)
but then I get the error:
Error in parse(text = lab) : <text>:1:11: unexpected numeric constant
1: rho==-0.5 0
^