Skip to content

Commit e022c04

Browse files
committed
TST: add test that CL works after manually setting the parallel position
1 parent 8f23c95 commit e022c04

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

lib/matplotlib/tests/test_constrainedlayout.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,3 +537,26 @@ def test_align_labels():
537537
after_align[1].x0, rtol=0, atol=1e-05)
538538
# ensure labels do not go off the edge
539539
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+
fig.supxlabel('Boo')
547+
fig.supylabel('Booy')
548+
fig.draw_no_output()
549+
pos = ax.get_tightbbox(fig.canvas.get_renderer())
550+
assert pos.y0 > pos0.y0 + 10.0
551+
assert pos.x0 > pos0.x0 + 10.0
552+
553+
fig, ax = plt.subplots(constrained_layout=True)
554+
fig.draw_no_output()
555+
pos0 = ax.get_tightbbox(fig.canvas.get_renderer())
556+
# check that specifying x (y) doesn't ruin the layout
557+
fig.supxlabel('Boo', x=0.5)
558+
fig.supylabel('Boo', y=0.5)
559+
fig.draw_no_output()
560+
pos = ax.get_tightbbox(fig.canvas.get_renderer())
561+
assert pos.y0 > pos0.y0 + 10.0
562+
assert pos.x0 > pos0.x0 + 10.0

0 commit comments

Comments
 (0)