Getting LaTeX into R Plots


I would like to add LaTeX typesetting to elements of plots in R (e.g: the title, axis labels, annotations, etc.) using either the combination of base/lattice or with ggplot2.


  • Is there a way to get LaTeX into plots using these packages, and if so, how is it done?
  • If not, are there additional packages needed to accomplish this.

For example, in Python matplotlib compiles LaTeX via the text.usetex packages as discussed here:

Is there a similar process by which such plots can be generated in R?

2/29/2016 8:19:50 AM

Here's an example using ggplot2:

q <- qplot(cty, hwy, data = mpg, colour = displ)
q + xlab(expression(beta +frac(miles, gallon)))

alt text

4/21/2019 7:48:26 PM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow