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

Appearance settings

Commit e9f1d7b

Browse filesBrowse files
authored
Merge pull request #26719 from oscargus/zordered
Fix issue with missing attribute in Path3DCollection
2 parents 0f04d86 + 41e38c5 commit e9f1d7b
Copy full SHA for e9f1d7b

File tree

2 files changed

+19
-0
lines changed
Filter options

2 files changed

+19
-0
lines changed

‎lib/mpl_toolkits/mplot3d/art3d.py

Copy file name to clipboardExpand all lines: lib/mpl_toolkits/mplot3d/art3d.py
+1Lines 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
if isinstance(col, PathCollection):
835835
col.__class__ = Path3DCollection
836+
col._offset_zordered = None
836837
elif isinstance(col, PatchCollection):
837838
col.__class__ = Patch3DCollection
838839
col._depthshade = depthshade

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

Copy file name to clipboardExpand all lines: lib/mpl_toolkits/mplot3d/tests/test_art3d.py
+18Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
import numpy as np
2+
13
import matplotlib.pyplot as plt
24

35
from matplotlib.backend_bases import MouseEvent
6+
from mpl_toolkits.mplot3d.art3d import Line3DCollection
47

58

69
def test_scatter_3d_projection_conservation():
@@ -36,3 +39,18 @@ def test_scatter_3d_projection_conservation():
3639
assert contains is True
3740
assert len(ind["ind"]) == 1
3841
assert ind["ind"][0] == i
42+
43+
44+
def test_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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.