forked from matplotlib/matplotlib
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
svn path=/trunk/matplotlib/; revision=5683
- Loading branch information
Showing
7 changed files
with
97 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
#!/usr/bin/env python | ||
from pylab import * | ||
t = arange(0.0, 1.01, 0.01) | ||
s = sin(2*2*pi*t) | ||
import numpy as np | ||
import matplotlib.pyplot as plt | ||
|
||
fill(t, s*exp(-5*t), 'r') | ||
grid(True) | ||
show() | ||
t = np.arange(0.0, 1.01, 0.01) | ||
s = np.sin(2*2*np.pi*t) | ||
|
||
plt.fill(t, s*np.exp(-5*t), 'r') | ||
plt.grid(True) | ||
plt.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,22 @@ | ||
#!/usr/bin/env python | ||
import pylab as P | ||
import numpy as np | ||
import matplotlib.mlab as mlab | ||
import matplotlib.pyplot as plt | ||
|
||
mu, sigma = 100, 15 | ||
x = mu + sigma*P.randn(10000) | ||
x = mu + sigma*np.random.randn(10000) | ||
|
||
# the histogram of the data | ||
n, bins, patches = P.hist(x, 50, normed=1) | ||
P.setp(patches, 'facecolor', 'g', 'alpha', 0.75) | ||
n, bins, patches = plt.hist(x, 50, normed=1, facecolor='green', alpha=0.75) | ||
|
||
# add a 'best fit' line | ||
y = P.normpdf( bins, mu, sigma) | ||
l = P.plot(bins, y, 'r--') | ||
P.setp(l, 'linewidth', 1) | ||
y = mlab.normpdf( bins, mu, sigma) | ||
l = plt.plot(bins, y, 'r--', linewidth=1) | ||
|
||
P.xlabel('Smarts') | ||
P.ylabel('Probability') | ||
P.title(r'$\mathrm{Histogram\ of\ IQ:}\ \mu=100,\ \sigma=15$') | ||
P.axis([40, 160, 0, 0.03]) | ||
P.grid(True) | ||
plt.xlabel('Smarts') | ||
plt.ylabel('Probability') | ||
plt.title(r'$\mathrm{Histogram\ of\ IQ:}\ \mu=100,\ \sigma=15$') | ||
plt.axis([40, 160, 0, 0.03]) | ||
plt.grid(True) | ||
|
||
#P.savefig('histogram_demo',dpi=72) | ||
P.show() | ||
plt.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,18 @@ | ||
#!/usr/bin/env python | ||
from pylab import * | ||
import numpy as np | ||
import matplotlib.cm as cm | ||
import matplotlib.mlab as mlab | ||
import matplotlib.pyplot as plt | ||
|
||
delta = 0.025 | ||
x = y = arange(-3.0, 3.0, delta) | ||
X, Y = meshgrid(x, y) | ||
Z1 = bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) | ||
Z2 = bivariate_normal(X, Y, 1.5, 0.5, 1, 1) | ||
x = y = np.arange(-3.0, 3.0, delta) | ||
X, Y = np.meshgrid(x, y) | ||
Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) | ||
Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1) | ||
Z = Z2-Z1 # difference of Gaussians | ||
|
||
im = imshow(Z, interpolation='bilinear', cmap=cm.gray, | ||
origin='lower', extent=[-3,3,-3,3]) | ||
im = plt.imshow(Z, interpolation='bilinear', cmap=cm.gray, | ||
origin='lower', extent=[-3,3,-3,3]) | ||
|
||
savefig('image_demo') | ||
show() | ||
plt.show() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../examples |