Skip to content

Commit c4dc4cd

Browse files
committed
Merge remote-tracking branch 'tonysyu/screenshots-update' into doc-fixes-1-3
Conflicts: doc/users/screenshots.rst
2 parents 4d2699e + 2c24467 commit c4dc4cd

File tree

8 files changed

+281
-357
lines changed

8 files changed

+281
-357
lines changed

doc/pyplots/tex_demo.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
#!/usr/bin/env python
21
"""
2+
Demo of TeX rendering.
3+
34
You can use TeX to render all of your matplotlib text if the rc
45
parameter text.usetex is set. This works currently on the agg and ps
56
backends, and requires that you have tex and the other dependencies
@@ -10,26 +11,25 @@
1011
~/.tex.cache
1112
1213
"""
13-
from matplotlib import rc
14-
from numpy import arange, cos, pi
15-
from matplotlib.pyplot import figure, axes, plot, xlabel, ylabel, title, \
16-
grid, savefig, show
14+
import numpy as np
15+
import matplotlib.pyplot as plt
1716

1817

19-
rc('text', usetex=True)
20-
rc('font', family='serif')
21-
figure(1, figsize=(6,4))
22-
ax = axes([0.1, 0.1, 0.8, 0.7])
23-
t = arange(0.0, 1.0+0.01, 0.01)
24-
s = cos(2*2*pi*t)+2
25-
plot(t, s)
18+
# Example data
19+
t = np.arange(0.0, 1.0 + 0.01, 0.01)
20+
s = np.cos(4 * np.pi * t) + 2
2621

27-
xlabel(r'\textbf{time (s)}')
28-
ylabel(r'\textit{voltage (mV)}',fontsize=16)
29-
title(r"\TeX\ is Number $\displaystyle\sum_{n=1}^\infty\frac{-e^{i\pi}}{2^n}$!",
30-
fontsize=16, color='r')
31-
grid(True)
32-
savefig('tex_demo')
22+
plt.rc('text', usetex=True)
23+
plt.rc('font', family='serif')
24+
plt.plot(t, s)
3325

26+
plt.xlabel(r'\textbf{time} (s)')
27+
plt.ylabel(r'\textit{voltage} (mV)',fontsize=16)
28+
plt.title(r"\TeX\ is Number "
29+
r"$\displaystyle\sum_{n=1}^\infty\frac{-e^{i\pi}}{2^n}$!",
30+
fontsize=16, color='gray')
31+
# Make room for the ridiculously large title.
32+
plt.subplots_adjust(top=0.8)
3433

35-
show()
34+
plt.savefig('tex_demo')
35+
plt.show()

0 commit comments

Comments
 (0)