Skip to content

Commit 5876d06

Browse files
committed
Add regression test for twinx top spine position
1 parent ce749b4 commit 5876d06

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

lib/matplotlib/tests/test_axes.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,21 @@ def test_twin_respects_position_after_set_position(twin):
484484
ax.set_position([0.2, 0.2, 0.5, 0.5])
485485
ax2 = getattr(ax, f"twin{twin}")()
486486

487-
assert_allclose(ax.get_position().bounds, ax2.get_position().bounds)
487+
assert_allclose(ax.get_position(original=True).bounds,
488+
ax2.get_position(original=True).bounds)
489+
490+
assert_allclose(ax.get_position(original=False).bounds,
491+
ax2.get_position(original=False).bounds)
492+
493+
494+
@pytest.mark.parametrize("twin", ("x", "y"))
495+
def test_twin_keeps_layout_participation_for_layout_managed_axes(twin):
496+
fig, ax = plt.subplots()
497+
498+
ax2 = getattr(ax, f"twin{twin}")()
499+
500+
assert ax.get_in_layout()
501+
assert ax2.get_in_layout()
488502

489503

490504
def test_inverted_cla():

0 commit comments

Comments
 (0)