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

Commit f132151

Browse filesBrowse files
neil-ptrmeeseeksmachine
authored andcommitted
Backport PR #18156: Fix IndexError when using scatter3d and depthshade=False
1 parent 6a6c6d1 commit f132151
Copy full SHA for f132151

File tree

Expand file treeCollapse file tree

2 files changed

+14
-2
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+14
-2
lines changed

‎lib/mpl_toolkits/mplot3d/art3d.py

Copy file name to clipboardExpand all lines: lib/mpl_toolkits/mplot3d/art3d.py
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -507,8 +507,9 @@ def do_3d_projection(self, renderer):
507507
vzs = vzs[z_markers_idx]
508508
vxs = vxs[z_markers_idx]
509509
vys = vys[z_markers_idx]
510-
fcs = fcs[z_markers_idx]
511-
ecs = ecs[z_markers_idx]
510+
if self._depthshade:
511+
fcs = fcs[z_markers_idx]
512+
ecs = ecs[z_markers_idx]
512513
if len(sizes) > 1:
513514
sizes = sizes[z_markers_idx]
514515
vps = np.column_stack((vxs, vys))

‎lib/mpl_toolkits/tests/test_mplot3d.py

Copy file name to clipboardExpand all lines: lib/mpl_toolkits/tests/test_mplot3d.py
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,17 @@ def test_scatter3d_color():
242242
color='b', marker='s')
243243

244244

245+
def test_scatter3d_depthshade_false():
246+
"""
247+
Test that 3d scatter plot doesn't throw
248+
IndexError with depthshade=False (issue #18037)
249+
"""
250+
x = y = z = np.arange(16)
251+
fig_test = plt.figure()
252+
ax_test = fig_test.add_subplot(projection='3d')
253+
ax_test.scatter(x, y, z, depthshade=False)
254+
255+
245256
@check_figures_equal(extensions=['png'])
246257
def test_scatter3d_size(fig_ref, fig_test):
247258
"""Test that large markers in correct position (issue #18135)"""

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.