3

I have the following code

     standard_text = "(%)"
    plotmath_text <- "I^2"
    g <- ggplot(data=data.frame(x=0,y=0))+geom_point(aes(x=x,y=y))
g+ annotate("text", x = 4.3, y = 6.97, label =standard_text)+
 annotate("text",x = 4, y = 7, cex = 7, label = plotmath_text,parse = TRUE )

That produces a graph where in its upper right corner has the annotation

I^2 (%)

Is there any way to create the same annotation using just annotate command once instead of two? I have tried to merge them into one command following that page but I was always getting errors.

tonytonov
  • 25,060
  • 16
  • 82
  • 98
Nick
  • 77
  • 1
  • 4

1 Answers1

2
annotate("text", x = 4, y = 7, cex = 7, label = "I^2 ~ ('%')", parse = TRUE)

enter image description here

UPD: related questions: one, two.

Community
  • 1
  • 1
tonytonov
  • 25,060
  • 16
  • 82
  • 98