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

Fix issue with missing attribute in Path3DCollection #26719

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions 1 lib/mpl_toolkits/mplot3d/art3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,7 @@ def patch_collection_2d_to_3d(col, zs=0, zdir='z', depthshade=True):
"""
if isinstance(col, PathCollection):
col.__class__ = Path3DCollection
col._offset_zordered = None
elif isinstance(col, PatchCollection):
col.__class__ = Patch3DCollection
col._depthshade = depthshade
Expand Down
18 changes: 18 additions & 0 deletions 18 lib/mpl_toolkits/mplot3d/tests/test_art3d.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import numpy as np

import matplotlib.pyplot as plt

from matplotlib.backend_bases import MouseEvent
from mpl_toolkits.mplot3d.art3d import Line3DCollection


def test_scatter_3d_projection_conservation():
Expand Down Expand Up @@ -36,3 +39,18 @@ def test_scatter_3d_projection_conservation():
assert contains is True
assert len(ind["ind"]) == 1
assert ind["ind"][0] == i


def test_zordered_error():
# Smoke test for https://github.com/matplotlib/matplotlib/issues/26497
lc = [(np.fromiter([0.0, 0.0, 0.0], dtype="float"),
np.fromiter([1.0, 1.0, 1.0], dtype="float"))]
pc = [np.fromiter([0.0, 0.0], dtype="float"),
np.fromiter([0.0, 1.0], dtype="float"),
np.fromiter([1.0, 1.0], dtype="float")]

fig = plt.figure()
ax = fig.add_subplot(projection="3d")
ax.add_collection(Line3DCollection(lc))
ax.scatter(*pc, visible=False)
plt.draw()
Morty Proxy This is a proxified and sanitized view of the page, visit original site.