diff --git a/lib/mpl_toolkits/mplot3d/axes3d.py b/lib/mpl_toolkits/mplot3d/axes3d.py index aeb6a66d2c98..a74c11f54e60 100644 --- a/lib/mpl_toolkits/mplot3d/axes3d.py +++ b/lib/mpl_toolkits/mplot3d/axes3d.py @@ -2374,7 +2374,7 @@ def scatter(self, xs, ys, zs=0, zdir='z', s=20, c=None, depthshade=True, xs, ys, zs, s, c, color = cbook.delete_masked_points( xs, ys, zs, s, c, kwargs.get('color', None) ) - if kwargs.get('color', None): + if kwargs.get("color") is not None: kwargs['color'] = color # For xs and ys, 2D scatter() will do the copying. diff --git a/lib/mpl_toolkits/mplot3d/tests/test_axes3d.py b/lib/mpl_toolkits/mplot3d/tests/test_axes3d.py index 1f8764cbab9d..9cebc8a33efc 100644 --- a/lib/mpl_toolkits/mplot3d/tests/test_axes3d.py +++ b/lib/mpl_toolkits/mplot3d/tests/test_axes3d.py @@ -2270,3 +2270,12 @@ def test_Poly3DCollection_init_value_error(): 'or both for shade to work.'): poly = np.array([[0, 0, 1], [0, 1, 1], [0, 0, 0]], float) c = art3d.Poly3DCollection([poly], shade=True) + + +def test_ndarray_color_kwargs_value_error(): + # smoke test + # ensures ndarray can be passed to color in kwargs for 3d projection plot + fig = plt.figure() + ax = fig.add_subplot(111, projection='3d') + ax.scatter(1, 0, 0, color=np.array([0, 0, 0, 1])) + fig.canvas.draw()