Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7394dba

Browse files
committed
added a couple of examples; fixed a gtk clip bug
svn path=/trunk/matplotlib/; revision=217
1 parent 1cec314 commit 7394dba

3 files changed

Lines changed: 39 additions & 8 deletions

File tree

TODO

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,4 +292,6 @@
292292

293293
-- support fontdicts, with deprecation as necessary
294294

295-
-- move text layout to front end and support newlines with rotation.
295+
-- move text layout to front end and support newlines with rotation.
296+
297+
-- aligment test of backend_ps and table_demo on all backends

examples/pcolor_demo2.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
"""
2+
See pcolor_demo2 for a much faster way of generating pcolor plots
3+
"""
4+
from __future__ import division
5+
from matplotlib.matlab import *
6+
7+
def func3(x,y):
8+
return (1- x/2 + x**5 + y**3)*exp(-x**2-y**2)
9+
10+
11+
# make these smaller to increase the resolution
12+
dx, dy = 0.05, 0.05
13+
14+
x = arange(-3.0, 3.0, dx)
15+
y = arange(-3.0, 3.0, dy)
16+
X,Y = meshgrid(x, y)
17+
18+
Z = func3(X, Y)
19+
cmap = ColormapJet(500)
20+
21+
ax = subplot(111)
22+
imshow(Z, cmap)
23+
ax.set_image_extent(-3, 3, -3, 3)
24+
#savefig('pcolor_demo2')
25+
show()
26+
27+

examples/psd_demo.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
1-
"""
2-
Compute the power spectral density of a signal
3-
"""
1+
# python
42

53
from matplotlib.matlab import *
64

75
dt = 0.01
86
t = arange(0,10,dt)
9-
nse = randn(len(t)) # white noise
7+
nse = randn(len(t))
108
r = exp(-t/0.05)
11-
cnse = convolve(nse, r, mode=2)*dt # colored noise
9+
10+
cnse = convolve(nse, r, mode=2)*dt
1211
cnse = cnse[:len(t)]
1312
s = 0.1*sin(2*pi*t) + cnse
13+
1414
figure(1)
1515
plot(t,s)
1616

1717
figure(2)
1818
psd(s, 512, 1/dt)
19-
#savefig('psd_demo')
20-
show()
19+
20+
savefig('psd_demo.png')
21+
22+
2123

2224
"""
2325
% compare with matlab

0 commit comments

Comments
 (0)