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=257
- Loading branch information
Showing
2 changed files
with
69 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
""" | ||
Top create plots that share a common axes (visually) you need to set | ||
the axes locations manually by supplying the appropriate axes | ||
rectangles. Normally you'll want to turn off the tick labels on all | ||
but one of the axes. | ||
In this example the plots share a common xaxis but you can follow the | ||
same logic to supply a common y axis. | ||
""" | ||
from matplotlib.matlab import * | ||
|
||
t = arange(0.0, 2.0, 0.01) | ||
|
||
s1 = sin(2*pi*t) | ||
s2 = exp(-t) | ||
s3 = s1*s2 | ||
|
||
# axes rect in relative 0,1 coords left, bottom, width, height. Turn | ||
# off xtick labels on all but the lower plot | ||
ax1 = axes([0.1, 0.1, 0.8, 0.25]) # lower | ||
ax2 = axes([0.1, 0.35, 0.8, 0.25]) # middle | ||
ax2.set_xticklabels([]) | ||
ax3 = axes([0.1, 0.6, 0.8, 0.25]) # upper | ||
ax3.set_xticklabels([]) | ||
|
||
ax1.plot(t,s1) | ||
ax2.plot(t,s2) | ||
ax3.plot(t,s3) | ||
|
||
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,39 @@ | ||
from matplotlib import rcParams | ||
rcParams['numerix'] = 'numarray' | ||
|
||
from matplotlib.matlab import * | ||
|
||
|
||
def bivariate_normal(X, Y, sigmax=1.0, sigmay=1.0, | ||
mux=0.0, muy=0.0, sigmaxy=0.0): | ||
""" | ||
Bivariate gaussan distribution for equal shape X, Y | ||
http://mathworld.wolfram.com/BivariateNormalDistribution.html | ||
""" | ||
Xmu = X-mux | ||
Ymu = Y-muy | ||
|
||
rho = sigmaxy/(sigmax*sigmay) | ||
z = Xmu**2/sigmax**2 + Ymu**2/sigmay - 2*rho*Xmu*Ymu/(sigmax*sigmay) | ||
return 1.0/(2*pi*sigmax*sigmay*(1-rho**2)) * exp( -z/(2*(1-rho**2))) | ||
|
||
|
||
delta = 0.025 | ||
x = arange(-3.0, 3.0, delta) | ||
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) | ||
|
||
# difference of Gaussians | ||
im = imshow(Z2-Z1) | ||
|
||
# set the interpolation method: 'nearest', 'bilinear', 'bicubic' and much more | ||
im.set_interpolation('bilinear') | ||
|
||
|
||
axis('off') | ||
#savefig('test') | ||
show() | ||
|