@@ -67,7 +67,7 @@ def delete_masked_points(*args):
6767 include arguments that can take string or array values, for
6868 example.
6969
70- Array arguments must all have the same shape, and must
70+ Array arguments must have the same length; masked arguments must
7171 be one-dimensional.
7272
7373 Written as a helper for scatter, but may be more generally
@@ -79,7 +79,7 @@ def delete_masked_points(*args):
7979 mask = reduce (ma .mask_or , masks )
8080 margs = []
8181 for x in args :
82- if shape (x ) == shape (mask ):
82+ if not is_string_like (x ) and len ( x ) == len (mask ):
8383 if (hasattr (x , 'get_compressed_copy' )):
8484 compressed_x = x .get_compressed_copy (mask )
8585 else :
@@ -3683,21 +3683,27 @@ def scatter(self, x, y, s=20, c='b', marker='o', cmap=None, norm=None,
36833683 faceted=True, **kwargs)
36843684 Supported function signatures:
36853685
3686- SCATTER(x, y) - make a scatter plot of x vs y
3686+ SCATTER(x, y, **kwargs)
3687+ SCATTER(x, y, s, **kwargs)
3688+ SCATTER(x, y, s, c, **kwargs)
36873689
3688- SCATTER(x, y, s) - make a scatter plot of x vs y with size in area
3689- given by s
3690+ Make a scatter plot of x versus y, where x, y are 1-D sequences
3691+ of the same length, N.
36903692
3691- SCATTER(x, y, s, c) - make a scatter plot of x vs y with size in area
3692- given by s and colors given by c
3693+ Arguments s and c can also be given as kwargs; this is encouraged
3694+ for readability.
36933695
3694- SCATTER(x, y, s, c, **kwargs) - control colormapping and scaling
3695- with keyword args; see below
3696+ s is a size in points^2. It is a scalar
3697+ or an array of the same length as x and y.
36963698
3697- Make a scatter plot of x versus y. s is a size in points^2 a scalar
3698- or an array of the same length as x or y. c is a color and can be a
3699- single color format string or a length(x) array of intensities which
3700- will be mapped by the matplotlib.colors.colormap instance cmap
3699+ c is a color and can be a single color format string,
3700+ or a sequence of color specifications of length N,
3701+ or a sequence of N numbers to be mapped to colors
3702+ using the cmap and norm specified via kwargs (see below).
3703+ Note that c should not be a single numeric RGB or RGBA
3704+ sequence because that is indistinguishable from an array
3705+ of values to be colormapped. c can be a 2-D array in which
3706+ the rows are RGB or RGBA, however.
37013707
37023708 The marker can be one of
37033709
@@ -3772,8 +3778,13 @@ def scatter(self, x, y, s=20, c='b', marker='o', cmap=None, norm=None,
37723778
37733779 # The inherent ambiguity is resolved in favor of color
37743780 # mapping, not interpretation as rgb or rgba.
3775- if not is_string_like (c ) and iterable (c ) and len (c )== len (x ):
3776- colors = None # use cmap, norm after collection is created
3781+
3782+ if not is_string_like (c ):
3783+ sh = shape (c )
3784+ if len (sh ) == 1 and sh [0 ] == len (x ):
3785+ colors = None # use cmap, norm after collection is created
3786+ else :
3787+ colors = colorConverter .to_rgba_list (c , alpha )
37773788 else :
37783789 colors = colorConverter .to_rgba_list (c , alpha )
37793790
0 commit comments