在ggplot注释中添加数学函数

时间:2016-07-29 13:26:32

标签: ggplot2 latex

我有一个使用ggplot的密度图,我有一个数学函数,我想在图形上使用+ annotate()或类似的东西,但我不知道如何做到这一点。

乳胶代码中我想要的符号是:

     $f_{\epsilon}(|R_{i}|)$

感谢您的帮助:)

1 个答案:

答案 0 :(得分:0)

试试这个,

# install.packages("latex2exp")

library(latex2exp)
test <- TeX("$f_{\\epsilon}(|R_{i}|)$")

library(grid)
grid.newpage()
grid.text(test, gp = gpar(cex=4))

enter image description here