Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3c58e2a

Browse filesBrowse files
authored
Merge pull request #15883 from anntzer/scatter-unsized
Improve error when passing 0d array to scatter().
2 parents f8a9a49 + eb38d25 commit 3c58e2a
Copy full SHA for 3c58e2a

File tree

Expand file treeCollapse file tree

1 file changed

+2
-3
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+2
-3
lines changed

‎lib/matplotlib/axes/_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axes/_axes.py
+2-3Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import collections.abc
21
import functools
32
import itertools
43
import logging
@@ -4204,7 +4203,7 @@ def _parse_scatter_color_args(c, edgecolors, kwargs, xsize,
42044203
else get_next_color_func())
42054204
c_is_string_or_strings = (
42064205
isinstance(c, str)
4207-
or (isinstance(c, collections.abc.Iterable) and len(c) > 0
4206+
or (np.iterable(c) and len(c) > 0
42084207
and isinstance(cbook.safe_first_element(c), str)))
42094208

42104209
def invalid_shape_exception(csize, xsize):
@@ -4238,7 +4237,7 @@ def invalid_shape_exception(csize, xsize):
42384237
if not c_is_mapped:
42394238
try: # Is 'c' acceptable as PathCollection facecolors?
42404239
colors = mcolors.to_rgba_array(c)
4241-
except ValueError:
4240+
except (TypeError, ValueError):
42424241
if not valid_shape:
42434242
raise invalid_shape_exception(c.size, xsize)
42444243
# Both the mapping *and* the RGBA conversion failed: pretty

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.