@@ -3788,6 +3788,12 @@ def scatter(self, x, y, s=20, c=None, marker='o', cmap=None, norm=None,
3788
3788
which case all masks will be combined and only unmasked points
3789
3789
will be plotted.
3790
3790
3791
+ Fundamentally, scatter works with 1-D arrays; `x`, `y`, `s`,
3792
+ and `c` may be input as 2-D arrays, but within scatter
3793
+ they will be flattened. The exception is `c`, which
3794
+ will be flattened only if its size matches the size of `x`
3795
+ and `y`.
3796
+
3791
3797
Examples
3792
3798
--------
3793
3799
.. plot:: mpl_examples/shapes_and_collections/scatter_demo.py
@@ -3839,13 +3845,13 @@ def scatter(self, x, y, s=20, c=None, marker='o', cmap=None, norm=None,
3839
3845
# After this block, c_array will be None unless
3840
3846
# c is an array for mapping. The potential ambiguity
3841
3847
# with a sequence of 3 or 4 numbers is resolved in
3842
- # favor mapping, not rgb or rgba.
3848
+ # favor of mapping, not rgb or rgba.
3843
3849
try :
3844
3850
c_array = np .asanyarray (c , dtype = float )
3845
- if c_array .shape == x .shape :
3851
+ if c_array .size == x .size :
3846
3852
c = np .ma .ravel (c_array )
3847
3853
else :
3848
- # Wrong shape ; it must not be intended for mapping.
3854
+ # Wrong size ; it must not be intended for mapping.
3849
3855
c_array = None
3850
3856
except ValueError :
3851
3857
# Failed to make a floating-point array; c must be color specs.
0 commit comments