@@ -1157,7 +1157,7 @@ def make_axes(parents, location=None, orientation=None, fraction=0.15,
1157
1157
1158
1158
1159
1159
@docstring .Substitution (make_axes_kw_doc )
1160
- def make_axes_gridspec (parents , ** kw ):
1160
+ def make_axes_gridspec (parent , ** kw ):
1161
1161
'''
1162
1162
Resize and reposition a parent axes, and return a child axes
1163
1163
suitable for a colorbar. This function is similar to
@@ -1204,35 +1204,13 @@ def make_axes_gridspec(parents, **kw):
1204
1204
pad_s = (1. - shrink ) * 0.5
1205
1205
wh_ratios = [pad_s , shrink , pad_s ]
1206
1206
1207
- # make parents a 1-d ndarray if its not already...
1208
- parents = np .atleast_1d (parents ).ravel ()
1209
- # get the appropriate subplot spec. Loop through the parents.
1210
- gs0 = parents [0 ].get_subplotspec ().get_gridspec ()
1211
- minind = 10000
1212
- maxind = - 10000
1213
- for parent in parents :
1214
- gs = parent .get_subplotspec ().get_gridspec ()
1215
- if gs == gs0 :
1216
- ss = parent .get_subplotspec ().get_geometry ()
1217
- if ss [2 ]< minind :
1218
- minind = ss [2 ]
1219
- if ss [3 ]> maxind :
1220
- maxind = ss [3 ]
1221
- else :
1222
- pass
1223
- print (minind )
1224
- print (maxind )
1225
- subspec = gridspec .SubplotSpec (gs0 ,minind ,maxind )
1226
- print (subspec )
1227
- print (subspec .get_geometry ())
1228
-
1229
1207
gs_from_subplotspec = gridspec .GridSpecFromSubplotSpec
1230
1208
if orientation == 'vertical' :
1231
1209
pad = kw .pop ('pad' , 0.05 )
1232
1210
wh_space = 2 * pad / (1 - pad )
1233
1211
1234
1212
gs = gs_from_subplotspec (1 , 2 ,
1235
- subplot_spec = subspec ,
1213
+ subplot_spec = parent . get_subplotspec () ,
1236
1214
wspace = wh_space ,
1237
1215
width_ratios = [x1 - pad , fraction ]
1238
1216
)
@@ -1242,8 +1220,6 @@ def make_axes_gridspec(parents, **kw):
1242
1220
hspace = 0. ,
1243
1221
height_ratios = wh_ratios ,
1244
1222
)
1245
- print (gs )
1246
- print (gs2 )
1247
1223
1248
1224
anchor = (0.0 , 0.5 )
1249
1225
panchor = (1.0 , 0.5 )
@@ -1252,7 +1228,7 @@ def make_axes_gridspec(parents, **kw):
1252
1228
wh_space = 2 * pad / (1 - pad )
1253
1229
1254
1230
gs = gs_from_subplotspec (2 , 1 ,
1255
- subplot_spec = subspec ,
1231
+ subplot_spec = parent . get_subplotspec () ,
1256
1232
hspace = wh_space ,
1257
1233
height_ratios = [x1 - pad , fraction ]
1258
1234
)
@@ -1267,13 +1243,12 @@ def make_axes_gridspec(parents, **kw):
1267
1243
anchor = (0.5 , 1.0 )
1268
1244
panchor = (0.5 , 0.0 )
1269
1245
1270
- for parent in parents :
1271
- parent .set_subplotspec (gs [0 ])
1272
- parent .update_params ()
1273
- parent .set_position (parent .figbox )
1274
- parent .set_anchor (panchor )
1246
+ parent .set_subplotspec (gs [0 ])
1247
+ parent .update_params ()
1248
+ parent .set_position (parent .figbox )
1249
+ parent .set_anchor (panchor )
1275
1250
1276
- fig = parents [ 0 ] .get_figure ()
1251
+ fig = parent .get_figure ()
1277
1252
cax = fig .add_subplot (gs2 [1 ])
1278
1253
cax .set_aspect (aspect , anchor = anchor , adjustable = 'box' )
1279
1254
return cax , kw
0 commit comments