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

Skip to content

Commit c18921a

Browse files
authored
Merge pull request #18509 from meeseeksmachine/auto-backport-of-pr-18505-on-v3.3.x
Backport PR #18505 on branch v3.3.x (Fix depth shading when edge/facecolor is none.)
2 parents e2dd1ba + a7ea044 commit c18921a

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
@@ -803,7 +803,7 @@ def _zalpha(colors, zs):
803803
# in all three dimensions. Otherwise, at certain orientations,
804804
# the min and max zs are very close together.
805805
# Should really normalize against the viewing depth.
806-
if len(zs) == 0:
806+
if len(colors) == 0 or len(zs) == 0:
807807
return np.zeros((0, 4))
808808
norm = Normalize(min(zs), max(zs))
809809
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)