stefano-meschiari / latex2exp

Use LaTeX in R graphics.
Other
185 stars 10 forks source link

in.na(x) warning when using TeX with ggplot2 #29

Closed jvcasillas closed 3 years ago

jvcasillas commented 3 years ago

When I use TeX inside of annotate in ggplot2 I get the following warning:

Warning message:
In is.na(x) : is.na() applied to non-(list or vector) of type 'expression'

Is there a way to get this warning to go away?

Here is a reproducible example:

ggplot(data.frame(x = c(-3, 3))) + 
      aes(x = x) + 
      stat_function(fun = dnorm, n = 100, args = list(mean = 0, sd = 1)) + 
      annotate("text", x = -2, y = 0.2, size = 7, 
        label = latex2exp::TeX("$\\textit{N}(0,1)$"), parse = TRUE)
jvcasillas commented 3 years ago

Disregard. Solved using output = "character"