Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -4251,7 +4251,7 @@ def invalid_shape_exception(csize, xsize):
try: # Is 'c' acceptable as PathCollection facecolors?
colors = mcolors.to_rgba_array(c)
except ValueError:
if not valid_shape:
if not valid_shape and c.shape[0] != xsize:
raise invalid_shape_exception(c.size, xsize)
# Both the mapping *and* the RGBA conversion failed: pretty
# severe failure => one may appreciate a verbose feedback.
Expand Down
2 changes: 2 additions & 0 deletions lib/matplotlib/tests/test_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1981,6 +1981,8 @@ def test_scatter_different_shapes(self, fig_test, fig_ref):
([[1, 0, 0, 0.5], "red", "jaune"], "conversion"),
([[1, 0, 0, 0.5], "red", "0.0", "jaune"], "conversion"),
([[1, 0, 0, 0.5], "red", "0.0", "C5", "jaune"], "conversion"),
# Invalid RGBA
([[2, 2, 2, 2]]*4, "conversion")
]

@pytest.mark.parametrize('c_case, re_key', params_test_scatter_c)
Expand Down