I need to annotate a location on a ggplot2 plot with a line that contains both a (real) greek letter and a number rounded to 2 decimal places. My problem arises because I wa
You can do it with the use of deparse
.
So your code looks like this
alpha_num <- "1.00"
p <- ggplot(data.frame(x=1,y=1,label=paste0("alpha == ", alpha_num)))
# Use deparse in label
p <- p + geom_text(aes(x,y,label=paste0("alpha == ", deparse(alpha_num))), parse = TRUE, size = 30)
p
And the output is: