Skip to content

Commit 303938f

Browse files
committed
DOC added documentation on frontpage example
1 parent 44a6d1d commit 303938f

File tree

4 files changed

+36
-6
lines changed

4 files changed

+36
-6
lines changed

examples/frontpage/plot_3D.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
"""
2-
Demonstrates using custom hillshading in a 3D surface plot.
2+
====================
3+
Frontpage 3D example
4+
====================
5+
6+
This example reproduces the frontpage 3D example.
7+
38
"""
49
from mpl_toolkits.mplot3d import Axes3D
510
from matplotlib import cbook
@@ -19,7 +24,7 @@
1924
region = np.s_[5:50, 5:50]
2025
x, y, z = x[region], y[region], z[region]
2126

22-
fig, ax = plt.subplots(subplot_kw=dict(projection='3d'))
27+
fig, ax = plt.subplots(subplot_kw=dict(projection='3d'), figsize=(2.25, 2))
2328

2429
ls = LightSource(270, 45)
2530
# To use a custom hillshading mode, override the built-in shading and pass
@@ -30,4 +35,4 @@
3035
ax.set_xticks([])
3136
ax.set_yticks([])
3237
ax.set_zticks([])
33-
fig.savefig("surface3D_frontpage.png")
38+
fig.savefig("surface3d_frontpage.png")

examples/frontpage/plot_contour.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
"""
2+
=========================
3+
Frontpage contour example
4+
=========================
5+
6+
This example reproduces the frontpage contour example.
7+
"""
8+
19
import matplotlib.pyplot as plt
210
import numpy as np
311
from matplotlib import mlab, cm
@@ -18,7 +26,7 @@
1826
levels = np.linspace(-2.0, 1.601, 40)
1927
norm = cm.colors.Normalize(vmax=abs(Z).max(), vmin=-abs(Z).max())
2028

21-
fig, ax = plt.subplots()
29+
fig, ax = plt.subplots(figsize=(2.25, 2))
2230
cset1 = ax.contourf(
2331
X, Y, Z, levels,
2432
norm=norm)

examples/frontpage/plot_histogram.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
1+
"""
2+
===========================
3+
Frontpage histogram example
4+
===========================
5+
6+
This example reproduces the frontpage histogram example.
7+
"""
8+
19
import matplotlib.pyplot as plt
210
import numpy as np
311

412

513
random_state = np.random.RandomState(19680801)
614
X = random_state.randn(10000)
715

8-
fig, ax = plt.subplots()
16+
fig, ax = plt.subplots(figsize=(2.25, 2))
917
ax.hist(X, bins=25, normed=True)
1018
x = np.linspace(-5, 5, 1000)
1119
ax.plot(x, 1 / np.sqrt(2*np.pi) * np.exp(-(x**2)/2), linewidth=4)

examples/frontpage/plot_membrane.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
"""
2+
======================
3+
Frontpage plot example
4+
======================
5+
6+
7+
This example reproduces the frontpage simple plot example.
8+
"""
9+
110
import matplotlib.pyplot as plt
211
import matplotlib.cbook as cbook
312
import numpy as np
@@ -7,7 +16,7 @@
716
x = np.fromstring(open(datafile, 'rb').read(), np.float32)
817
# 0.0005 is the sample interval
918

10-
fig, ax = plt.subplots()
19+
fig, ax = plt.subplots(figsize=(2.25, 2))
1120
ax.plot(x, linewidth=4)
1221
ax.set_xlim(5000, 6000)
1322
ax.set_ylim(-0.6, 0.1)

0 commit comments

Comments
 (0)