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

Skip to content

Commit 593e41f

Browse files
committed
TST: test that belnded transforms autolim
1 parent eb343fd commit 593e41f

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

lib/matplotlib/tests/test_collections.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,3 +612,17 @@ def test_EventCollection_nosort():
612612
arr = np.array([3, 2, 1, 10])
613613
coll = EventCollection(arr)
614614
np.testing.assert_array_equal(arr, np.array([3, 2, 1, 10]))
615+
616+
617+
def test_blended_collection_autolim():
618+
a = [1, 2, 4]
619+
height = .2
620+
621+
xy_pairs = np.column_stack([np.repeat(a, 2), np.tile([0, height], len(a))])
622+
line_segs = xy_pairs.reshape([len(a), 2, 2])
623+
624+
f, ax = plt.subplots()
625+
trans = mtransforms.blended_transform_factory(ax.transData, ax.transAxes)
626+
ax.add_collection(LineCollection(line_segs, transform=trans))
627+
ax.autoscale_view(scalex=True, scaley=False)
628+
np.testing.assert_allclose(ax.get_xlim(), [1., 4.])

0 commit comments

Comments
 (0)