Skip to content

Commit

Permalink
Merge pull request #4646 from ericmjl/mep12-tex_unicode_demo.py
Browse files Browse the repository at this point in the history
MEP12 on tex_unicode_demo.py
  • Loading branch information
jenshnielsen committed Jul 20, 2015
2 parents 4c88c1f + d119526 commit 1812c99
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions examples/pylab_examples/tex_unicode_demo.py
Expand Up @@ -4,23 +4,24 @@
This demo is tex_demo.py modified to have unicode. See that file for
more information.
"""

from __future__ import unicode_literals
import matplotlib as mpl
mpl.rcParams['text.usetex'] = True
mpl.rcParams['text.latex.unicode'] = True
from numpy import arange, cos, pi
from matplotlib.pyplot import (figure, axes, plot, xlabel, ylabel, title,
grid, savefig, show)
import numpy as np
import matplotlib
matplotlib.rcParams['text.usetex'] = True
matplotlib.rcParams['text.latex.unicode'] = True
import matplotlib.pyplot as plt

figure(1, figsize=(6, 4))
ax = axes([0.1, 0.1, 0.8, 0.7])
t = arange(0.0, 1.0 + 0.01, 0.01)
s = cos(2*2*pi*t) + 2
plot(t, s)
plt.figure(1, figsize=(6, 4))
ax = plt.axes([0.1, 0.1, 0.8, 0.7])
t = np.arange(0.0, 1.0 + 0.01, 0.01)
s = np.cos(2*2*np.pi*t) + 2
plt.plot(t, s)

xlabel(r'\textbf{time (s)}')
ylabel(r'\textit{Velocity (\u00B0/sec)}', fontsize=16)
title(r"\TeX\ is Number $\displaystyle\sum_{n=1}^\infty\frac{-e^{i\pi}}{2^n}$!",
fontsize=16, color='r')
grid(True)
show()
plt.xlabel(r'\textbf{time (s)}')
plt.ylabel(r'\textit{Velocity (\u00B0/sec)}', fontsize=16)
plt.title(r"\TeX\ is Number \
$\displaystyle\sum_{n=1}^\infty\frac{-e^{i\pi}}{2^n}$!",
fontsize=16, color='r')
plt.grid(True)
plt.show()

0 comments on commit 1812c99

Please sign in to comment.