From a7f4397cc551755dd721d22493afa17ab61de951 Mon Sep 17 00:00:00 2001 From: Jody Klymak Date: Fri, 3 Apr 2020 11:12:17 -0700 Subject: [PATCH 1/2] FIX: force blended transforms with data to be in data space --- lib/matplotlib/collections.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From ba075b147f9dbd297f9c3343e9f0893582f70b6d Mon Sep 17 00:00:00 2001 From: Jody Klymak Date: Fri, 3 Apr 2020 11:55:14 -0700 Subject: [PATCH 2/2] TST: test that blended transforms autolim --- lib/matplotlib/tests/test_collections.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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.]) pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

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:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy