*) Error due Scatter () due to irregularities in the parameter
Reference link: https: //matplotlib.org/3.1.0/api/_as_gen/matplotlib.pyplot.scatter.html highlight = scatter # matplotlib.pyplot.scatter?
Marker Color. Possible values:
- Monochrome format string.
- A series of color specifications of length n.
- Use cmap and norm mapped to the sequence of n digital color .
- A two-dimensional array, where the line is RGB or RGBA.
Note, C should not be a single sequence of digital RGB or RGBA, because it can not distinguish between the color array of values to be mapped. To specify the same value for all RGB or RGBA point, a two-dimensional array having a single row. Otherwise, the size of x and y case of a match, the matching value will take precedence .
The default is None
. In this case, the color of the marker is determined by the valuecolor
, facecolor
or facecolors
. If not specified orNone
marker color, the color of the mark Axes
"current" shape at a determined color and fill "color cycle." This is the default cyclercParams["axes.prop_cycle"]
.
ax.scatter(X1,X1,c=b) ax.scatter(X2,X2,c=b,s=50) ax.scatter(X1,X1,c=g)
We will complain:
(sort) λ python matplotlib_learn.py [1, 2, 3, 4, 5] Traceback (most recent call last): File "C:\Users\Administrator.SC-201605202132\Envs\sort\lib\site-packages\matplotlib\cbook\__init__.py", line 216, in process func(*args, **kwargs) File "C:\Users\Administrator.SC-201605202132\Envs\sort\lib\site-packages\matplotlib\animation.py", line 953, in _start self._init_draw() File "C:\Users\Administrator.SC-201605202132\Envs\sort\lib\site-packages\matplotlib\animation.py", line 1732, in _init_draw self._draw_frame(next(self.new_frame_seq())) File "C:\Users\Administrator.SC-201605202132\Envs\sort\lib\site-packages\matplotlib\animation.py", line 1755, in _draw_frame self._drawn_artists = self._func(framedata, *self._args) File "matplotlib_learn.py", line 184, in update_insert ax.scatter(X2,X2,c=b,s=50) File "C:\Users\Administrator.SC-201605202132\Envs\sort\lib\site-packages\matplotlib\__init__.py", line 1589, in inner return func(ax, *map(sanitize_sequence, args), **kwargs) File "C:\Users\Administrator.SC-201605202132\Envs\sort\lib\site-packages\matplotlib\axes\_axes.py", line 4446, in scatter get_next_color_func=self._get_patches_for_fill.get_next_color) File "C:\Users\Administrator.SC-201605202132\Envs\sort\lib\site-packages\matplotlib\axes\_axes.py", line 4257, in _parse_scatter_color_args n_elem = c_array.shape[0] IndexError: tuple index out of range