Skip to content

Commit d451a8e

Browse files
authored
Merge pull request #26725 from meeseeksmachine/auto-backport-of-pr-26719-on-v3.7.x
Backport PR #26719 on branch v3.7.x (Fix issue with missing attribute in Path3DCollection)
2 parents 2e1ad11 + 2d9ea85 commit d451a8e

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
@@ -808,6 +808,7 @@ def patch_collection_2d_to_3d(col, zs=0, zdir='z', depthshade=True):
808808
"""
809809
if isinstance(col, PathCollection):
810810
col.__class__ = Path3DCollection
811+
col._offset_zordered = None
811812
elif isinstance(col, PatchCollection):
812813
col.__class__ = Patch3DCollection
813814
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+
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)
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