8000 merged the tex_X.py files into a single file tex.py · ngoldbaum/matplotlib@a0f91fa · GitHub
[go: up one dir, main page]

Skip to content

Commit a0f91fa

Browse files
helmiriawanQuLogic
authored andcommitted
merged the tex_X.py files into a single file tex.py
1 parent 268420b commit a0f91fa

File tree

2 files changed

+21
-33
lines changed

2 files changed

+21
-33
lines changed

examples/pylab_examples/tex_demo.py renamed to examples/pylab_examples/tex.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,14 @@
1313
~/.tex.cache
1414
1515
"""
16+
from __future__ import unicode_literals
1617
import numpy as np
18+
import matplotlib
19+
matplotlib.rcParams['text.usetex'] = True
20+
matplotlib.rcParams['text.latex.unicode'] = True
1721
import matplotlib.pyplot as plt
1822

1923

20-
plt.rc('text', usetex=True)
2124
plt.rc('font', family='serif')
2225
plt.figure(1, figsize=(6, 4))
2326
ax = plt.axes([0.1, 0.1, 0.8, 0.7])
@@ -27,8 +30,23 @@
2730

2831
plt.xlabel(r'\textbf{time (s)}')
2932
plt.ylabel(r'\textit{voltage (mV)}', fontsize=16)
30-
plt.title(r"\TeX\ is Number $\displaystyle\sum_{n=1}^\infty"
31-
r"\frac{-e^{i\pi}}{2^n}$!", fontsize=16, color='r')
33+
plt.title(r'\TeX\ is Number $\displaystyle\sum_{n=1}^\infty'
34+
r'\frac{-e^{i\pi}}{2^n}$!', fontsize=16, color='r')
3235
plt.grid(True)
3336
plt.savefig('tex_demo')
3437
plt.show()
38+
39+
40+
41+
plt.figure(2, figsize=(6, 4))
42+
ax = plt.axes([0.1, 0.1, 0.8, 0.7])
43+
t = np.arange(0.0, 1.0 + 0.01, 0.01)
44+
s = np.cos(2*2*np.pi*t) + 2
45+
plt.plot(t, s)
46+
47+
plt.xlabel(r'\textbf{time (s)}')
48+
plt.ylabel('\\textit{Velocity (\u00B0/sec)}', fontsize=16)
49+
plt.title(r'\TeX\ is Number $\displaystyle\sum_{n=1}^\infty'
50+
r'\frac{-e^{i\pi}}{2^n}$!', fontsize=16, color='r')
51+
plt.grid(True)
52+
plt.show()

examples/pylab_examples/tex_unicode_demo.py

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)
0