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

Skip to content

Commit 641d2fa

Browse files
authored
Merge pull request #18505 from QuLogic/empty-depthshading
Fix depth shading when edge/facecolor is none.
2 parents a4128a7 + 22627ca commit 641d2fa

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

lib/mpl_toolkits/mplot3d/art3d.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -809,7 +809,7 @@ def _zalpha(colors, zs):
809809
# in all three dimensions. Otherwise, at certain orientations,
810810
# the min and max zs are very close together.
811811
# Should really normalize against the viewing depth.
812-
if len(zs) == 0:
812+
if len(colors) == 0 or len(zs) == 0:
813813
return np.zeros((0, 4))
814814
norm = Normalize(min(zs), max(zs))
815815
sats = 1 - norm(zs) * 0.7

lib/mpl_toolkits/tests/test_mplot3d.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,14 @@ def test_scatter3d():
237237
def test_scatter3d_color():
238238
fig = plt.figure()
239239
ax = fig.add_subplot(111, projection='3d')
240+
241+
# Check that 'none' color works; these two should overlay to produce the
242+
# same as setting just `color`.
243+
ax.scatter(np.arange(10), np.arange(10), np.arange(10),
244+
facecolor='r', edgecolor='none', marker='o')
240245
ax.scatter(np.arange(10), np.arange(10), np.arange(10),
241-
color='r', marker='o')
246+
facecolor='none', edgecolor='r', marker='o')
247+
242248
ax.scatter(np.arange(10, 20), np.arange(10, 20), np.arange(10, 20),
243249
color='b', marker='s')
244250

0 commit comments

Comments
 (0)