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

Commitaa02297

Browse files
tacaswellmeeseeksmachine
authored andcommitted
Backport PRmatplotlib#26719: Fix issue with missing attribute in Path3DCollection
1 parent70f4990 commitaa02297

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

‎lib/mpl_toolkits/mplot3d/art3d.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -833,6 +833,7 @@ def patch_collection_2d_to_3d(col, zs=0, zdir='z', depthshade=True):
833833
"""
834834
ifisinstance(col,PathCollection):
835835
col.__class__=Path3DCollection
836+
col._offset_zordered=None
836837
elifisinstance(col,PatchCollection):
837838
col.__class__=Patch3DCollection
838839
col._depthshade=depthshade

‎lib/mpl_toolkits/mplot3d/tests/test_art3d.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
importnumpyasnp
2+
13
importmatplotlib.pyplotasplt
24

35
frommatplotlib.backend_basesimportMouseEvent
6+
frommpl_toolkits.mplot3d.art3dimportLine3DCollection
47

58

69
deftest_scatter_3d_projection_conservation():
@@ -36,3 +39,18 @@ def test_scatter_3d_projection_conservation():
3639
assertcontainsisTrue
3740
assertlen(ind["ind"])==1
3841
assertind["ind"][0]==i
42+
43+
44+
deftest_zordered_error():
45+
# Smoke test for https://github.com/matplotlib/matplotlib/issues/26497
46+
lc= [(np.fromiter([0.0,0.0,0.0],dtype="float"),
47+
np.fromiter([1.0,1.0,1.0],dtype="float"))]
48+
pc= [np.fromiter([0.0,0.0],dtype="float"),
49+
np.fromiter([0.0,1.0],dtype="float"),
50+
np.fromiter([1.0,1.0],dtype="float")]
51+
52+
fig=plt.figure()
53+
ax=fig.add_subplot(projection="3d")
54+
ax.add_collection(Line3DCollection(lc))
55+
ax.scatter(*pc,visible=False)
56+
plt.draw()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp