Sometimes, you may need to add LaTeX mathematical expressions to a Matplotlib plot. For example, adding Greek symbols, superscript, subscript or formulas to the axis labels, plot title or tick labels.

Doing that is very easy in Matplotlib. Just indicate the text to be a raw string and enclose the mathematical expression in dollar signs. For example:

import matplotlib.pyplot as mplot
mplot.xlabel(r"$x_1 > x_3$")

**Tried with:** Python 2.7.6 and Ubuntu 14.04

### Like this:

Like Loading...

*Related*