File tree 1 file changed +18
-22
lines changed 1 file changed +18
-22
lines changed Original file line number Diff line number Diff line change 1
- #!/usr/bin/env python
2
1
# Working with multiple figure windows and subplots
3
- from pylab import *
2
+ import matplotlib .pyplot as plt
3
+ import numpy as np
4
4
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 )
8
8
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 )
14
14
15
- figure (2 )
16
- plot (t , s2 )
15
+ plt . figure (2 )
16
+ plt . plot (t , s2 )
17
17
18
18
# 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 ([])
23
24
24
- figure (1 )
25
- savefig ('fig1' )
26
- figure (2 )
27
- savefig ('fig2' )
28
-
29
- show ()
25
+ plt .show ()
You can’t perform that action at this time.
0 commit comments