diff --git a/lib/matplotlib/collections.py b/lib/matplotlib/collections.py index 390866fb80ea..eab47a160fa0 100644 --- a/lib/matplotlib/collections.py +++ b/lib/matplotlib/collections.py @@ -219,7 +219,7 @@ def get_datalim(self, transData): # get_path_collection_extents handles nan but not masked arrays if len(paths) and len(offsets): - if transform.contains_branch(transData): + if any(transform.contains_branch_seperately(transData)): # collections that are just in data units (like quiver) # can properly have the axes limits set by their shape + # offset. LineCollections that have no offsets can diff --git a/lib/matplotlib/tests/test_collections.py b/lib/matplotlib/tests/test_collections.py index 9f1954dfd94e..84eaf25fd4e9 100644 --- a/lib/matplotlib/tests/test_collections.py +++ b/lib/matplotlib/tests/test_collections.py @@ -616,3 +616,17 @@ def test_collection_set_verts_array(): for ap, lp in zip(col_arr._paths, col_list._paths): assert np.array_equal(ap._vertices, lp._vertices) assert np.array_equal(ap._codes, lp._codes) + + +def test_blended_collection_autolim(): + a = [1, 2, 4] + height = .2 + + xy_pairs = np.column_stack([np.repeat(a, 2), np.tile([0, height], len(a))]) + line_segs = xy_pairs.reshape([len(a), 2, 2]) + + f, ax = plt.subplots() + trans = mtransforms.blended_transform_factory(ax.transData, ax.transAxes) + ax.add_collection(LineCollection(line_segs, transform=trans)) + ax.autoscale_view(scalex=True, scaley=False) + np.testing.assert_allclose(ax.get_xlim(), [1., 4.])
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: