@@ -16,51 +16,48 @@ def setup(ax, text):
16
16
left = False , labelleft = False )
17
17
18
18
19
- ##############################################################################
20
- # Fixed axes sizes; fixed paddings.
19
+ fig = plt . figure ( figsize = ( 12 , 6 ))
20
+ sfs = fig . subfigures ( 1 , 2 )
21
21
22
- fig = plt .figure (figsize = (6 , 6 ))
23
- fig .suptitle ("Fixed axes sizes, fixed paddings" )
24
22
23
+ sfs [0 ].suptitle ("Fixed axes sizes, fixed paddings" )
25
24
# Sizes are in inches.
26
25
horiz = [Size .Fixed (1. ), Size .Fixed (.5 ), Size .Fixed (1.5 ), Size .Fixed (.5 )]
27
26
vert = [Size .Fixed (1.5 ), Size .Fixed (.5 ), Size .Fixed (1. )]
28
27
29
28
rect = (0.1 , 0.1 , 0.8 , 0.8 )
30
29
# Divide the axes rectangle into a grid with sizes specified by horiz * vert.
31
- divider = Divider (fig , rect , horiz , vert , aspect = False )
30
+ div = Divider (sfs [ 0 ] , rect , horiz , vert , aspect = False )
32
31
33
32
# The rect parameter will actually be ignored and overridden by axes_locator.
34
- ax1 = fig .add_axes (rect , axes_locator = divider .new_locator (nx = 0 , ny = 0 ))
33
+ ax1 = sfs [ 0 ] .add_axes (rect , axes_locator = div .new_locator (nx = 0 , ny = 0 ))
35
34
setup (ax1 , "nx=0, ny=0" )
36
- ax2 = fig .add_axes (rect , axes_locator = divider .new_locator (nx = 0 , ny = 2 ))
35
+ ax2 = sfs [ 0 ] .add_axes (rect , axes_locator = div .new_locator (nx = 0 , ny = 2 ))
37
36
setup (ax2 , "nx=0, ny=2" )
38
- ax3 = fig .add_axes (rect , axes_locator = divider .new_locator (nx = 2 , ny = 2 ))
37
+ ax3 = sfs [ 0 ] .add_axes (rect , axes_locator = div .new_locator (nx = 2 , ny = 2 ))
39
38
setup (ax3 , "nx=2, ny=2" )
40
- ax4 = fig .add_axes (rect , axes_locator = divider .new_locator (nx = 2 , nx1 = 4 , ny = 0 ))
39
+ ax4 = sfs [ 0 ] .add_axes (rect , axes_locator = div .new_locator (nx = 2 , nx1 = 4 , ny = 0 ))
41
40
setup (ax4 , "nx=2, nx1=4, ny=0" )
42
41
43
- ##############################################################################
44
- # Axes sizes that scale with the figure size; fixed paddings.
45
-
46
- fig = plt .figure (figsize = (6 , 6 ))
47
- fig .suptitle ("Scalable axes sizes, fixed paddings" )
48
42
43
+ sfs [1 ].suptitle ("Scalable axes sizes, fixed paddings" )
44
+ # Fixed sizes are in inches, scaled sizes are relative.
49
45
horiz = [Size .Scaled (1.5 ), Size .Fixed (.5 ), Size .Scaled (1. ), Size .Scaled (.5 )]
50
46
vert = [Size .Scaled (1. ), Size .Fixed (.5 ), Size .Scaled (1.5 )]
51
47
52
48
rect = (0.1 , 0.1 , 0.8 , 0.8 )
53
49
# Divide the axes rectangle into a grid with sizes specified by horiz * vert.
54
- divider = Divider (fig , rect , horiz , vert , aspect = False )
50
+ div = Divider (sfs [ 1 ] , rect , horiz , vert , aspect = False )
55
51
56
52
# The rect parameter will actually be ignored and overridden by axes_locator.
57
- ax1 = fig .add_axes (rect , axes_locator = divider .new_locator (nx = 0 , ny = 0 ))
53
+ ax1 = sfs [ 1 ] .add_axes (rect , axes_locator = div .new_locator (nx = 0 , ny = 0 ))
58
54
setup (ax1 , "nx=0, ny=0" )
59
- ax2 = fig .add_axes (rect , axes_locator = divider .new_locator (nx = 0 , ny = 2 ))
55
+ ax2 = sfs [ 1 ] .add_axes (rect , axes_locator = div .new_locator (nx = 0 , ny = 2 ))
60
56
setup (ax2 , "nx=0, ny=2" )
61
- ax3 = fig .add_axes (rect , axes_locator = divider .new_locator (nx = 2 , ny = 2 ))
57
+ ax3 = sfs [ 1 ] .add_axes (rect , axes_locator = div .new_locator (nx = 2 , ny = 2 ))
62
58
setup (ax3 , "nx=2, ny=2" )
63
- ax4 = fig .add_axes (rect , axes_locator = divider .new_locator (nx = 2 , nx1 = 4 , ny = 0 ))
59
+ ax4 = sfs [ 1 ] .add_axes (rect , axes_locator = div .new_locator (nx = 2 , nx1 = 4 , ny = 0 ))
64
60
setup (ax4 , "nx=2, nx1=4, ny=0" )
65
61
62
+
66
63
plt .show ()
0 commit comments