File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -2426,9 +2426,12 @@ def __init__(self,
2426
2426
if isinstance (tight_layout , dict ):
2427
2427
self .get_layout_engine ().set (** tight_layout )
2428
2428
elif constrained_layout is not None :
2429
- self .set_layout_engine (layout = 'constrained' )
2430
2429
if isinstance (constrained_layout , dict ):
2430
+ self .set_layout_engine (layout = 'constrained' )
2431
2431
self .get_layout_engine ().set (** constrained_layout )
2432
+ elif constrained_layout :
2433
+ self .set_layout_engine (layout = 'constrained' )
2434
+
2432
2435
else :
2433
2436
# everything is None, so use default:
2434
2437
self .set_layout_engine (layout = layout )
Original file line number Diff line number Diff line change @@ -656,3 +656,14 @@ def test_compressed1():
656
656
pos = axs [1 , 2 ].get_position ()
657
657
np .testing .assert_allclose (pos .x1 , 0.8618 , atol = 1e-3 )
658
658
np .testing .assert_allclose (pos .y0 , 0.1934 , atol = 1e-3 )
659
+
660
+
661
+ @pytest .mark .parametrize ('arg, state' , [
662
+ (True , True ),
663
+ (False , False ),
664
+ ({}, True ),
665
+ ({'rect' : None }, True )
666
+ ])
667
+ def test_set_constrained_layout (arg , state ):
668
+ fig , ax = plt .subplots (constrained_layout = arg )
669
+ assert fig .get_constrained_layout () is state
You can’t perform that action at this time.
0 commit comments