Skip to content

Commit c2a343c

Browse files
committed
Add tests for twin axes alignment with manual positioning_layout
1 parent e8df9e5 commit c2a343c

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

lib/matplotlib/tests/test_axes.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -502,11 +502,13 @@ def test_twin_keeps_layout_participation_for_layout_managed_axes(twin):
502502

503503

504504
@pytest.mark.parametrize("twin", ("x", "y"))
505-
def test_twin_stays_aligned_after_tight_layout(twin):
506-
fig,ax = plt.subplots()
505+
def test_twin_stays_aligned_after_constrained_layout(twin):
506+
fig, ax = plt.subplots(constrained_layout=True)
507+
508+
ax.set_position([0.2, 0.2, 0.5, 0.5])
507509
ax2 = getattr(ax, f"twin{twin}")()
508510

509-
fig.tight_layout()
511+
fig.canvas.draw()
510512

511513
assert_allclose(ax.get_position().bounds, ax2.get_position().bounds)
512514

0 commit comments

Comments
 (0)