File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 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+
Original file line number Diff line number Diff line change 1- """
2- Compute the power spectral density of a signal
3- """
1+ # python
42
53from matplotlib .matlab import *
64
75dt = 0.01
86t = arange (0 ,10 ,dt )
9- nse = randn (len (t )) # white noise
7+ nse = randn (len (t ))
108r = exp (- t / 0.05 )
11- cnse = convolve (nse , r , mode = 2 )* dt # colored noise
9+
10+ cnse = convolve (nse , r , mode = 2 )* dt
1211cnse = cnse [:len (t )]
1312s = 0.1 * sin (2 * pi * t ) + cnse
13+
1414figure (1 )
1515plot (t ,s )
1616
1717figure (2 )
1818psd (s , 512 , 1 / dt )
19- #savefig('psd_demo')
20- show ()
19+
20+ savefig ('psd_demo.png' )
21+
22+
2123
2224"""
2325% compare with matlab
You can’t perform that action at this time.
0 commit comments