From 9afc05a6c33a1ae654d6664f14e42e885a854609 Mon Sep 17 00:00:00 2001 From: David Stansby Date: Sat, 25 Jul 2020 14:00:33 +0100 Subject: [PATCH 1/2] Fix 'none' handling in to_rgba_array --- lib/matplotlib/colors.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/colors.py b/lib/matplotlib/colors.py index 2cc74083103a..7db342275d34 100644 --- a/lib/matplotlib/colors.py +++ b/lib/matplotlib/colors.py @@ -316,7 +316,7 @@ def to_rgba_array(c, alpha=None): # `to_rgba(c, alpha)` (below) is expensive for such inputs, due to the need # to format the array in the ValueError message(!). if cbook._str_lower_equal(c, "none"): - return np.zeros((0, 4), float) + return np.zeros((1, 4), float) try: return np.array([to_rgba(c, alpha)], float) except (ValueError, TypeError): From 47a0a58d87806c7b03972943c61ee48064e51b46 Mon Sep 17 00:00:00 2001 From: David Stansby Date: Sat, 25 Jul 2020 14:01:23 +0100 Subject: [PATCH 2/2] Add test for 3D scatter with unfilled marker --- lib/mpl_toolkits/tests/test_mplot3d.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/mpl_toolkits/tests/test_mplot3d.py b/lib/mpl_toolkits/tests/test_mplot3d.py index 37532335e38d..a8d311da2b4f 100644 --- a/lib/mpl_toolkits/tests/test_mplot3d.py +++ b/lib/mpl_toolkits/tests/test_mplot3d.py @@ -232,6 +232,14 @@ def test_scatter3d(): z[-1] = 0 # Check that scatter() copies the data. +def test_scatter3d_nonfilledmarker(): + # Check that scattering a non-filled marker works + fig = plt.figure() + ax = fig.add_subplot(111, projection='3d') + ax.scatter(np.arange(10), np.arange(10), np.arange(10), marker='x') + fig.canvas.draw() + + @mpl3d_image_comparison(['scatter3d_color.png']) def test_scatter3d_color(): fig = plt.figure()