plot - How do I write " *value* *plus-minus sign* *value* ", along with text, with annotate of ggplot2, R? -
here's problem:
library(ggplot2) = c(4, 2) x = c(1:4) y = c(1:4) # works (τ^-1 = 4 s^-1): l <- paste("tau^-1 ==", a[1], "*~s^-1") qplot(x, y) + annotate("text", x = 1.5, y = 3.5, parse=true, label = l); # see ( τ^-1 = 4 ± 2 s^-1): l <- paste("tau^-1 ==", a[1], "\u00b1", a[2], "*~s^-1") qplot(x, y) + annotate("text", x = 1.5, y = 3.5, parse=true, label = l);
it gives me error:
error in parse(text = lab) : <text>:1:13: unexpected input 1: tau^-1 == 4 ± ^
can me please? thank in advance!
if set parse = true
label displayed described in ?plotmath
. on page can find table avaiable features , proper syntax.
in case have use %+-%
instead of unicode symbol \u00b1
r able coerce expression.
l <- paste("tau^-1 ==", a[1], "%+-%", a[2], "*~s^-1") qplot(x, y) + annotate("text", x = 1.5, y = 3.5, parse=true, label = l)
Comments
Post a Comment