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

Skip to content

Backport PR #18156 on branch v3.3.x (Fix IndexError when using scatter3d and depthshade=False) #18162

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
5 changes: 3 additions & 2 deletions lib/mpl_toolkits/mplot3d/art3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,8 +507,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
11 changes: 11 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,17 @@ def test_scatter3d_color():
color='b', marker='s')


def test_scatter3d_depthshade_false():
"""
Test that 3d scatter plot doesn't throw
IndexError with depthshade=False (issue #18037)
"""
x = y = z = np.arange(16)
fig_test = plt.figure()
ax_test = fig_test.add_subplot(projection='3d')
ax_test.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