@@ -10,97 +10,96 @@ def example_plot(ax):
1010 ax .set_ylabel ('y-label' , fontsize = random .choice (fontsizes ))
1111 ax .set_title ('Title' , fontsize = random .choice (fontsizes ))
1212
13- if 1 :
14- fig , ax = plt .subplots ()
15- example_plot (ax )
16- plt .tight_layout ()
13+ fig , ax = plt .subplots ()
14+ example_plot (ax )
15+ plt .tight_layout ()
1716
18- fig , ((ax1 , ax2 ), (ax3 , ax4 )) = plt .subplots (nrows = 2 , ncols = 2 )
19- example_plot (ax1 )
20- example_plot (ax2 )
21- example_plot (ax3 )
22- example_plot (ax4 )
23- plt .tight_layout ()
17+ fig , ((ax1 , ax2 ), (ax3 , ax4 )) = plt .subplots (nrows = 2 , ncols = 2 )
18+ example_plot (ax1 )
19+ example_plot (ax2 )
20+ example_plot (ax3 )
21+ example_plot (ax4 )
22+ plt .tight_layout ()
2423
25- fig , (ax1 , ax2 ) = plt .subplots (nrows = 2 , ncols = 1 )
26- example_plot (ax1 )
27- example_plot (ax2 )
28- plt .tight_layout ()
24+ fig , (ax1 , ax2 ) = plt .subplots (nrows = 2 , ncols = 1 )
25+ example_plot (ax1 )
26+ example_plot (ax2 )
27+ plt .tight_layout ()
2928
30- fig , (ax1 , ax2 ) = plt .subplots (nrows = 1 , ncols = 2 )
31- example_plot (ax1 )
32- example_plot (ax2 )
33- plt .tight_layout ()
29+ fig , (ax1 , ax2 ) = plt .subplots (nrows = 1 , ncols = 2 )
30+ example_plot (ax1 )
31+ example_plot (ax2 )
32+ plt .tight_layout ()
3433
35- fig , axes = plt .subplots (nrows = 3 , ncols = 3 )
36- for row in axes :
37- for ax in row :
38- example_plot (ax )
39- plt .tight_layout ()
34+ fig , axes = plt .subplots (nrows = 3 , ncols = 3 )
35+ for row in axes :
36+ for ax in row :
37+ example_plot (ax )
38+ plt .tight_layout ()
4039
4140
42- fig = plt .figure ()
41+ fig = plt .figure ()
4342
44- ax1 = plt .subplot (221 )
45- ax2 = plt .subplot (223 )
46- ax3 = plt .subplot (122 )
43+ ax1 = plt .subplot (221 )
44+ ax2 = plt .subplot (223 )
45+ ax3 = plt .subplot (122 )
4746
48- example_plot (ax1 )
49- example_plot (ax2 )
50- example_plot (ax3 )
47+ example_plot (ax1 )
48+ example_plot (ax2 )
49+ example_plot (ax3 )
5150
52- plt .tight_layout ()
51+ plt .tight_layout ()
5352
5453
55- fig = plt .figure ()
54+ fig = plt .figure ()
5655
57- ax1 = plt .subplot2grid ((3 , 3 ), (0 , 0 ))
58- ax2 = plt .subplot2grid ((3 , 3 ), (0 , 1 ), colspan = 2 )
59- ax3 = plt .subplot2grid ((3 , 3 ), (1 , 0 ), colspan = 2 , rowspan = 2 )
60- ax4 = plt .subplot2grid ((3 , 3 ), (1 , 2 ), rowspan = 2 )
56+ ax1 = plt .subplot2grid ((3 , 3 ), (0 , 0 ))
57+ ax2 = plt .subplot2grid ((3 , 3 ), (0 , 1 ), colspan = 2 )
58+ ax3 = plt .subplot2grid ((3 , 3 ), (1 , 0 ), colspan = 2 , rowspan = 2 )
59+ ax4 = plt .subplot2grid ((3 , 3 ), (1 , 2 ), rowspan = 2 )
6160
62- example_plot (ax1 )
63- example_plot (ax2 )
64- example_plot (ax3 )
65- example_plot (ax4 )
61+ example_plot (ax1 )
62+ example_plot (ax2 )
63+ example_plot (ax3 )
64+ example_plot (ax4 )
6665
67- plt .tight_layout ()
66+ plt .tight_layout ()
6867
69- plt .show ()
68+ plt .show ()
7069
7170
72- fig = plt .figure ()
71+ fig = plt .figure ()
7372
74- import matplotlib .gridspec as gridspec
73+ import matplotlib .gridspec as gridspec
7574
76- gs1 = gridspec .GridSpec (3 , 1 )
77- ax1 = fig .add_subplot (gs1 [0 ])
78- ax2 = fig .add_subplot (gs1 [1 ])
79- ax3 = fig .add_subplot (gs1 [2 ])
75+ gs1 = gridspec .GridSpec (3 , 1 )
76+ ax1 = fig .add_subplot (gs1 [0 ])
77+ ax2 = fig .add_subplot (gs1 [1 ])
78+ ax3 = fig .add_subplot (gs1 [2 ])
8079
81- example_plot (ax1 )
82- example_plot (ax2 )
83- example_plot (ax3 )
80+ example_plot (ax1 )
81+ example_plot (ax2 )
82+ example_plot (ax3 )
8483
85- gs1 .tight_layout (fig , rect = [None , None , 0.45 , None ])
84+ gs1 .tight_layout (fig , rect = [None , None , 0.45 , None ])
8685
87- gs2 = gridspec .GridSpec (2 , 1 )
88- ax4 = fig .add_subplot (gs2 [0 ])
89- ax5 = fig .add_subplot (gs2 [1 ])
86+ gs2 = gridspec .GridSpec (2 , 1 )
87+ ax4 = fig .add_subplot (gs2 [0 ])
88+ ax5 = fig .add_subplot (gs2 [1 ])
9089
91- #example_plot(ax4)
92- #example_plot(ax5)
90+ #example_plot(ax4)
91+ #example_plot(ax5)
9392
94- gs2 .tight_layout (fig , rect = [0.45 , None , None , None ])
93+ gs2 .tight_layout (fig , rect = [0.45 , None , None , None ])
9594
96- # now match the top and bottom of two gridspecs.
97- top = min (gs1 .top , gs2 .top )
98- bottom = max (gs1 .bottom , gs2 .bottom )
95+ # now match the top and bottom of two gridspecs.
96+ top = min (gs1 .top , gs2 .top )
97+ bottom = max (gs1 .bottom , gs2 .bottom )
9998
100- gs1 .update (top = top , bottom = bottom )
101- gs2 .update (top = top , bottom = bottom )
102-
103- plt .show ()
99+ gs1 .update (top = top , bottom = bottom )
100+ gs2 .update (top = top , bottom = bottom )
101+
102+ plt .show ()
104103
105104
106105
0 commit comments