I have to admit that I find the
plotmath expressions in R a little fiddly to annotate plots with mathematical notation.
The package provides the wonderful function
latex2exp that translates LaTeX code into
plotmath expressions. Brillant! All I have to remember is to escape the
"" character, that is write
"\" instead of
Below is the first example from the
plotmath help file and again using
latex2exp. I think this is much easier to read and write.
R version 3.2.1 (2015-06-18)<br />Platform: x86_64-apple-darwin13.4.0 (64-bit)<br />Running under: OS X 10.10.4 (Yosemite)<br /><br />locale:<br /> en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8<br /><br />attached base packages:<br /> stats graphics grDevices utils datasets methods base <br /><br />other attached packages:<br /> latex2exp_0.3.1<br /><br />loaded via a namespace (and not attached):<br /> magrittr_1.5 tools_3.2.1 Rcpp_0.11.6 stringi_0.5-5 stringr_1.0.0