Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfd09e5c

Browse files
authored
Merge pull request#17020 from jklymak/backport17017
Merge pull request#17017 from jklymak/fix-blended-transform
2 parents8ac76de +cfff1bc commitfd09e5c

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

‎lib/matplotlib/collections.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ def get_datalim(self, transData):
221221
# get_path_collection_extents handles nan but not masked arrays
222222

223223
iflen(paths)andlen(offsets):
224-
iftransform.contains_branch(transData):
224+
ifany(transform.contains_branch_seperately(transData)):
225225
# collections that are just in data units (like quiver)
226226
# can properly have the axes limits set by their shape +
227227
# offset. LineCollections that have no offsets can

‎lib/matplotlib/tests/test_collections.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -718,3 +718,17 @@ def test_EventCollection_nosort():
718718
arr=np.array([3,2,1,10])
719719
coll=EventCollection(arr)
720720
np.testing.assert_array_equal(arr,np.array([3,2,1,10]))
721+
722+
723+
deftest_blended_collection_autolim():
724+
a= [1,2,4]
725+
height=.2
726+
727+
xy_pairs=np.column_stack([np.repeat(a,2),np.tile([0,height],len(a))])
728+
line_segs=xy_pairs.reshape([len(a),2,2])
729+
730+
f,ax=plt.subplots()
731+
trans=mtransforms.blended_transform_factory(ax.transData,ax.transAxes)
732+
ax.add_collection(LineCollection(line_segs,transform=trans))
733+
ax.autoscale_view(scalex=True,scaley=False)
734+
np.testing.assert_allclose(ax.get_xlim(), [1.,4.])

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp