File tree Expand file tree Collapse file tree 1 file changed +22
-21
lines changed Expand file tree Collapse file tree 1 file changed +22
-21
lines changed Original file line number Diff line number Diff line change 1- #!/usr/bin/env python
21# Working with multiple figure windows and subplots
3- from pylab import *
2+ import matplotlib .pyplot as plt
3+ import numpy as np
44
5- t = arange (0.0 , 2.0 , 0.01 )
6- s1 = sin (2 * pi * t )
7- s2 = sin (4 * pi * t )
5+ t = np . arange (0.0 , 2.0 , 0.01 )
6+ s1 = np . sin (2 * np . pi * t )
7+ s2 = np . sin (4 * np . pi * t )
88
9- figure (1 )
10- subplot (211 )
11- plot (t , s1 )
12- subplot (212 )
13- plot (t , 2 * s1 )
9+ plt . figure (1 )
10+ plt . subplot (211 )
11+ plt . plot (t , s1 )
12+ plt . subplot (212 )
13+ plt . plot (t , 2 * s1 )
1414
15- figure (2 )
16- plot (t , s2 )
15+ plt . figure (2 )
16+ plt . plot (t , s2 )
1717
1818# now switch back to figure 1 and make some changes
19- figure (1 )
20- subplot (211 )
21- plot (t , s2 , 'gs' )
22- setp (gca (), 'xticklabels' , [])
19+ plt .figure (1 )
20+ plt .subplot (211 )
21+ plt .plot (t , s2 , 'gs' )
22+ ax = plt .gca ()
23+ ax .set_xticklabels ([])
2324
24- figure (1 )
25- savefig ('fig1' )
26- figure (2 )
27- savefig ('fig2' )
25+ plt . figure (1 )
26+ plt . savefig ('fig1' )
27+ plt . figure (2 )
28+ plt . savefig ('fig2' )
2829
29- show ()
30+ plt . show ()
You can’t perform that action at this time.
0 commit comments