Skip to content

Commit ba075b1

Browse files
committed
TST: test that blended transforms autolim
1 parent a7f4397 commit ba075b1

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

lib/matplotlib/tests/test_collections.py

+14
Original file line numberDiff line numberDiff line change
@@ -616,3 +616,17 @@ def test_collection_set_verts_array():
616616
for ap, lp in zip(col_arr._paths, col_list._paths):
617617
assert np.array_equal(ap._vertices, lp._vertices)
618618
assert np.array_equal(ap._codes, lp._codes)
619+
620+
621+
def test_blended_collection_autolim():
622+
a = [1, 2, 4]
623+
height = .2
624+
625+
xy_pairs = np.column_stack([np.repeat(a, 2), np.tile([0, height], len(a))])
626+
line_segs = xy_pairs.reshape([len(a), 2, 2])
627+
628+
f, ax = plt.subplots()
629+
trans = mtransforms.blended_transform_factory(ax.transData, ax.transAxes)
630+
ax.add_collection(LineCollection(line_segs, transform=trans))
631+
ax.autoscale_view(scalex=True, scaley=False)
632+
np.testing.assert_allclose(ax.get_xlim(), [1., 4.])

0 commit comments

Comments
 (0)