Skip to content

Commit 702a0a9

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

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

lib/matplotlib/tests/test_constrainedlayout.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,3 +537,27 @@ 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+
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

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy