You are reading an old version of the documentation (v1.4.3). For the latest version see

We're updating the default styles for Matplotlib 2.0

Learn what to expect in the new updates


Previous topic

pylab_examples example code:

Next topic

pylab_examples example code:

This Page

pylab_examples example code: mathtext_demo.pyΒΆ

(Source code, png, hires.png, pdf)

#!/usr/bin/env python
Use matplotlib's internal LaTeX parser and layout engine.  For true
latex rendering, see the text.usetex option
import numpy as np
from matplotlib.pyplot import figure, show

fig = figure()

ax = fig.add_subplot(111, axisbg='y')
ax.plot([1,2,3], 'r')
x = np.arange(0.0, 3.0, 0.1)

ax.set_xlabel(r'$\Delta_i^j$', fontsize=20)
ax.set_ylabel(r'$\Delta_{i+1}^j$', fontsize=20)
tex = r'$\mathcal{R}\prod_{i=\alpha_{i+1}}^\infty a_i\sin(2 \pi f x_i)$'

ax.text(1, 1.6, tex, fontsize=20, va='bottom')


ax.set_title(r'$\Delta_i^j \hspace{0.4} \mathrm{versus} \hspace{0.4} \Delta_{i+1}^j$', fontsize=20)


Keywords: python, matplotlib, pylab, example, codex (see Search examples)