8000 ENH new static images for the frontpage by NelleV · Pull Request #7541 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

ENH new static images for the frontpage #7541

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 3, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
DOC added documentation on frontpage example
  • Loading branch information
NelleV committed Dec 2, 2016
commit 303938f8f7102590d3d71c42d65fc403b54228cf
11 changes: 8 additions & 3 deletions examples/frontpage/plot_3D.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
"""
Demonstrates using custom hillshading in a 3D surface plot.
====================
Frontpage 3D example
====================

This example reproduces the frontpage 3D example.

"""
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cbook
Expand All @@ -19,7 +24,7 @@
region = np.s_[5:50, 5:50]
x, y, z = x[region], y[region], z[region]

fig, ax = plt.subplots(subplot_kw=dict(projection='3d'))
fig, ax = plt.subplots(subplot_kw=dict(projection='3d'), figsize=(2.25, 2))

ls = LightSource(270, 45)
# To use a custom hillshading mode, override the built-in shading and pass
Expand All @@ -30,4 +35,4 @@
ax.set_xticks([])
ax.set_yticks([])
ax.set_zticks([])
fig.savefig("surface3D_frontpage.png")
fig.savefig("surface3d_frontpage.png")
10 changes: 9 additions & 1 deletion examples/frontpage/plot_contour.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
"""
=========================
Frontpage contour example
=========================

This example reproduces the frontpage contour example.
"""

import matplotlib.pyplot as plt
import numpy as np
from matplotlib import mlab, cm
Expand All @@ -18,7 +26,7 @@
levels = np.linspace(-2.0, 1.601, 40)
norm = cm.colors.Normalize(vmax=abs(Z).max(), vmin=-abs(Z).max())

fig, ax = plt.subplots()
fig, ax = plt.subplots(figsize=(2.25, 2))
cset1 = ax.contourf(
X, Y, Z, levels,
norm=norm)
Expand Down
10 changes: 9 additions & 1 deletion examples/frontpage/plot_histogram.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
"""
===========================
Frontpage histogram example
===========================

This example reproduces the frontpage histogram example.
"""

import matplotlib.pyplot as plt
import numpy as np


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

fig, ax = plt.subplots()
fig, ax = plt.subplots(figsize=(2.25, 2))
ax.hist(X, bins=25, normed=True)
x = np.linspace(-5, 5, 1000)
ax.plot(x, 1 / np.sqrt(2*np.pi) * np.exp(-(x**2)/2), linewidth=4)
Expand Down
11 changes: 10 additions & 1 deletion examples/frontpage/plot_membrane.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
"""
======================
Frontpage plot example
======================


This example reproduces the frontpage simple plot example.
"""

import matplotlib.pyplot as plt
import matplotlib.cbook as cbook
import numpy as np
Expand All @@ -7,7 +16,7 @@
x = np.fromstring(open(datafile, 'rb').read(), np.float32)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

np.fromfile(datafile, np.float32)

# 0.0005 is the sample interval

fig, ax = plt.subplots()
fig, ax = plt.subplots(figsize=(2.25, 2))
ax.plot(x, linewidth=4)
ax.set_xlim(5000, 6000)
ax.set_ylim(-0.6, 0.1)
Expand Down
0