@@ -18,48 +18,51 @@ def label_axes(ax, text):
1818 left = False , labelleft = False )
1919
2020
21- fig = plt . figure ( figsize = ( 12 , 6 ))
22- sfs = fig . subfigures ( 1 , 2 )
21+ ##############################################################################
22+ # Fixed axes sizes; fixed paddings.
2323
24+ fig = plt .figure (figsize = (6 , 6 ))
25+ fig .suptitle ("Fixed axes sizes, fixed paddings" )
2426
25- sfs [0 ].suptitle ("Fixed axes sizes, fixed paddings" )
2627# Sizes are in inches.
2728horiz = [Size .Fixed (1. ), Size .Fixed (.5 ), Size .Fixed (1.5 ), Size .Fixed (.5 )]
2829vert = [Size .Fixed (1.5 ), Size .Fixed (.5 ), Size .Fixed (1. )]
2930
3031rect = (0.1 , 0.1 , 0.8 , 0.8 )
3132# Divide the axes rectangle into a grid with sizes specified by horiz * vert.
32- div = Divider (sfs [ 0 ] , rect , horiz , vert , aspect = False )
33+ div = Divider (fig , rect , horiz , vert , aspect = False )
3334
3435# The rect parameter will actually be ignored and overridden by axes_locator.
35- ax1 = sfs [ 0 ] .add_axes (rect , axes_locator = div .new_locator (nx = 0 , ny = 0 ))
36+ ax1 = fig .add_axes (rect , axes_locator = div .new_locator (nx = 0 , ny = 0 ))
3637label_axes (ax1 , "nx=0, ny=0" )
37- ax2 = sfs [ 0 ] .add_axes (rect , axes_locator = div .new_locator (nx = 0 , ny = 2 ))
38+ ax2 = fig .add_axes (rect , axes_locator = div .new_locator (nx = 0 , ny = 2 ))
3839label_axes (ax2 , "nx=0, ny=2" )
39- ax3 = sfs [ 0 ] .add_axes (rect , axes_locator = div .new_locator (nx = 2 , ny = 2 ))
40+ ax3 = fig .add_axes (rect , axes_locator = div .new_locator (nx = 2 , ny = 2 ))
4041label_axes (ax3 , "nx=2, ny=2" )
41- ax4 = sfs [ 0 ] .add_axes (rect , axes_locator = div .new_locator (nx = 2 , nx1 = 4 , ny = 0 ))
42+ ax4 = fig .add_axes (rect , axes_locator = div .new_locator (nx = 2 , nx1 = 4 , ny = 0 ))
4243label_axes (ax4 , "nx=2, nx1=4, ny=0" )
4344
45+ ##############################################################################
46+ # Axes sizes that scale with the figure size; fixed paddings.
47+
48+ fig = plt .figure (figsize = (6 , 6 ))
49+ fig .suptitle ("Scalable axes sizes, fixed paddings" )
4450
45- sfs [1 ].suptitle ("Scalable axes sizes, fixed paddings" )
46- # Fixed sizes are in inches, scaled sizes are relative.
4751horiz = [Size .Scaled (1.5 ), Size .Fixed (.5 ), Size .Scaled (1. ), Size .Scaled (.5 )]
4852vert = [Size .Scaled (1. ), Size .Fixed (.5 ), Size .Scaled (1.5 )]
4953
5054rect = (0.1 , 0.1 , 0.8 , 0.8 )
5155# Divide the axes rectangle into a grid with sizes specified by horiz * vert.
52- div = Divider (sfs [ 1 ] , rect , horiz , vert , aspect = False )
56+ div = Divider (fig , rect , horiz , vert , aspect = False )
5357
5458# The rect parameter will actually be ignored and overridden by axes_locator.
55- ax1 = sfs [ 1 ] .add_axes (rect , axes_locator = div .new_locator (nx = 0 , ny = 0 ))
59+ ax1 = fig .add_axes (rect , axes_locator = div .new_locator (nx = 0 , ny = 0 ))
5660label_axes (ax1 , "nx=0, ny=0" )
57- ax2 = sfs [ 1 ] .add_axes (rect , axes_locator = div .new_locator (nx = 0 , ny = 2 ))
61+ ax2 = fig .add_axes (rect , axes_locator = div .new_locator (nx = 0 , ny = 2 ))
5862label_axes (ax2 , "nx=0, ny=2" )
59- ax3 = sfs [ 1 ] .add_axes (rect , axes_locator = div .new_locator (nx = 2 , ny = 2 ))
63+ ax3 = fig .add_axes (rect , axes_locator = div .new_locator (nx = 2 , ny = 2 ))
6064label_axes (ax3 , "nx=2, ny=2" )
61- ax4 = sfs [ 1 ] .add_axes (rect , axes_locator = div .new_locator (nx = 2 , nx1 = 4 , ny = 0 ))
65+ ax4 = fig .add_axes (rect , axes_locator = div .new_locator (nx = 2 , nx1 = 4 , ny = 0 ))
6266label_axes (ax4 , "nx=2, nx1=4, ny=0" )
6367
64-
6568plt .show ()
0 commit comments