8000 Fix missing Patch3DCollection._z_markers_idx by slavoutich · Pull Request #20416 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Fix missing Patch3DCollection._z_markers_idx #20416

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
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 lib/mpl_toolkits/mplot3d/art3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,7 @@ def set_3d_properties(self, zs, zdir):
xs = []
ys = []
self._offsets3d = juggle_axes(xs, ys, np.atleast_1d(zs), zdir)
self._z_markers_idx = slice(-1)
self._vzs = None
self.stale = True

Expand Down
18 changes: 11 additions & 7 deletions lib/mpl_toolkits/tests/test_mplot3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -601,22 +601,26 @@ def test_patch_modification():
@check_figures_equal(extensions=['png'])
def test_patch_collection_modification(fig_test, fig_ref):
# Test that modifying Patch3DCollection properties after creation works.
patch = Circle((0, 0), 0.05)
c = art3d.Patch3DCollection([patch], linewidths=3)
patch1 = Circle((0, 0), 0.05)
patch2 = Circle((0.1, 0.1), 0.03)
facecolors = np.array([[0., 0.5, 0., 1.], [0.5, 0., 0., 0.5]])
c = art3d.Patch3DCollection([patch1, patch2], linewidths=3)

ax_test = fig_test.add_subplot(projection='3d')
ax_test.add_collection3d(c)
c.set_edgecolor('C2')
c.set_facecolor('C3')
c.set_facecolor(facecolors)
c.set_alpha(0.7)
assert c.get_depthshade()
c.set_depthshade(False)
assert not c.get_depthshade()

patch = Circle((0, 0), 0.05)
c = art3d.Patch3DCollection([patch], linewidths=3,
edgecolor='C2', facecolor='C3', alpha=0.7,
depthshade=False)
patch1 = Circle((0, 0), 0.05)
patch2 = Circle((0.1, 0.1), 0.03)
facecolors = np.array([[0., 0.5, 0., 1.], [0.5, 0., 0., 0.5]])
c = art3d.Patch3DCollection([patch1, patch2], linewidths=3,
edgecolor='C2', facecolor=facecolors,
alpha=0.7, depthshade=False)

ax_ref = fig_ref.add_subplot(projection='3d')
ax_ref.add_collection3d(c)
Expand Down
0