@@ -403,9 +403,25 @@ def _align_spines(fig, gs):
403
403
if height0 > height1 :
404
404
ax0 ._poslayoutbox .constrain_height_min (
405
405
ax1 ._poslayoutbox .height * height0 / height1 )
406
+ # the precise constraint must be weak because
407
+ # we may have one col with two axes, and the other
408
+ # column with just one, and we want the top and
409
+ # bottom of the short axes to align with the large one,
410
+ # so the height of the long one is greater than
411
+ # twice the height of the small ones. OTOH, if the
412
+ # axes are not so constrained, we would like the pos
413
+ # boxes to be the proper relative widths.
414
+ # See test_constrained_layout17 fo
415
+ ax0 ._poslayoutbox .constrain_height (
416
+ ax1 ._poslayoutbox .height * height0 / height1 ,
417
+ strength = 'weak' )
406
418
elif height0 < height1 :
407
419
ax1 ._poslayoutbox .constrain_height_min (
408
420
ax0 ._poslayoutbox .height * height1 / height0 )
421
+ # see above
422
+ ax1 ._poslayoutbox .constrain_height (
423
+ ax0 ._poslayoutbox .height * height1 / height0 ,
424
+ strength = 'weak' )
409
425
# For widths, do it if the subplots share a row.
410
426
if not alignwidth and len (colspan0 ) == len (colspan1 ):
411
427
ax0 ._poslayoutbox .constrain_width (
@@ -415,9 +431,17 @@ def _align_spines(fig, gs):
415
431
if width0 > width1 :
416
432
ax0 ._poslayoutbox .constrain_width_min (
417
433
ax1 ._poslayoutbox .width * width0 / width1 )
434
+ # see comment above
435
+ ax0 ._poslayoutbox .constrain_width (
436
+ ax1 ._poslayoutbox .width * width0 / width1 ,
437
+ strength = 'weak' )
418
438
elif width0 < width1 :
419
439
ax1 ._poslayoutbox .constrain_width_min (
420
440
ax0 ._poslayoutbox .width * width1 / width0 )
441
+ # see comment above
442
+ ax1 ._poslayoutbox .constrain_width_min (
443
+ ax0 ._poslayoutbox .width * width1 / width0 ,
444
+ strength = 'weak' )
421
445
422
446
423
447
def _arrange_subplotspecs (gs , hspace = 0 , wspace = 0 ):
0 commit comments