Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix IndexError when using scatter3d and depthshade=False #18156

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 5 commits into from
Aug 3, 2020
Merged
Show file tree
Hide file tree
Changes from 4 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
5 changes: 3 additions & 2 deletions lib/mpl_toolkits/mplot3d/art3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,8 +508,9 @@ def do_3d_projection(self, renderer):
vzs = vzs[z_markers_idx]
vxs = vxs[z_markers_idx]
vys = vys[z_markers_idx]
fcs = fcs[z_markers_idx]
ecs = ecs[z_markers_idx]
if self._depthshade:
fcs = fcs[z_markers_idx]
ecs = ecs[z_markers_idx]
if len(sizes) > 1:
sizes = sizes[z_markers_idx]
vps = np.column_stack((vxs, vys))
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions lib/mpl_toolkits/tests/test_mplot3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,19 @@ def test_scatter3d_color():
color='b', marker='s')


@check_figures_equal(extensions=['png'])
def test_scatter3d_depthshade_false(fig_ref, fig_test):
"""
Test that 3d scatter plot doesn't throw
IndexError with depthshade=False (issue #18037)
"""
x = y = z = np.arange(16)
ax_test = fig_test.add_subplot(projection='3d')
ax_ref = fig_ref.add_subplot(projection='3d')
ax_test.scatter(x, y, z, depthshade=False)
ax_ref.scatter(x, y, z, depthshade=False)


@check_figures_equal(extensions=['png'])
def test_scatter3d_size(fig_ref, fig_test):
"""Test that large markers in correct position (issue #18135)"""
Expand Down