File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -537,3 +537,27 @@ def test_align_labels():
537
537
after_align [1 ].x0 , rtol = 0 , atol = 1e-05 )
538
538
# ensure labels do not go off the edge
539
539
assert after_align [0 ].x0 >= 1
540
+
541
+
542
+ def test_suplabels ():
543
+ fig , ax = plt .subplots (constrained_layout = True )
544
+ fig .draw_no_output ()
545
+ pos0 = ax .get_tightbbox (fig .canvas .get_renderer ())
546
+ print (pos0 )
547
+ fig .supxlabel ('Boo' )
548
+ fig .supylabel ('Booy' )
549
+ fig .draw_no_output ()
550
+ pos = ax .get_tightbbox (fig .canvas .get_renderer ())
551
+ assert pos .y0 > pos0 .y0 + 10.0
552
+ assert pos .x0 > pos0 .x0 + 10.0
553
+
554
+ fig , ax = plt .subplots (constrained_layout = True )
555
+ fig .draw_no_output ()
556
+ pos0 = ax .get_tightbbox (fig .canvas .get_renderer ())
557
+ # check that specifying x (y) doesn't ruin the layout
558
+ fig .supxlabel ('Boo' , x = 0.5 )
559
+ fig .supylabel ('Boo' , y = 0.5 )
560
+ fig .draw_no_output ()
561
+ pos = ax .get_tightbbox (fig .canvas .get_renderer ())
562
+ assert pos .y0 > pos0 .y0 + 10.0
563
+ assert pos .x0 > pos0 .x0 + 10.0
You can’t perform that action at this time.
0 commit comments