Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 126f6a8

Browse files
committed
TST: add a test
1 parent 45a723a commit 126f6a8

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

lib/matplotlib/tests/test_figure.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -778,3 +778,18 @@ def test_fail(self, x, match):
778778
def test_hashable_keys(self, fig_test, fig_ref):
779779
fig_test.subplot_mosaic([[object(), object()]])
780780
fig_ref.subplot_mosaic([["A", "B"]])
781+
782+
783+
def test_reused_gridspec():
784+
"""Test that these all use the same gridspec"""
785+
fig = plt.figure()
786+
ax1 = fig.add_subplot(3, 2, (3, 5))
787+
ax2 = fig.add_subplot(3, 2, 4)
788+
ax3 = plt.subplot2grid((3, 2), (2, 1), colspan=2, fig=fig)
789+
790+
gs1 = ax1.get_subplotspec().get_gridspec()
791+
gs2 = ax2.get_subplotspec().get_gridspec()
792+
gs3 = ax3.get_subplotspec().get_gridspec()
793+
794+
assert gs1 == gs2
795+
assert gs1 == gs3

0 commit comments

Comments
 (0)