Why can't the color of each point be set in color in python's scatter?
巴扎黑
巴扎黑 2017-05-18 11:02:35
0
1
1246
plt.scatter(x=rw.x_value,y=rw.y_value,c=point_number,colormap=plt.cm.Blues,gecolors='none',s=15)

where point_number refers to a series of points, and then uses range() to generate a list of numbers, and uses color mapping, but when running, an error ValueError: Invalid RGBA argument: 0
is used in python3
I would like to ask how the color parameter in scatter can be set for each point

巴扎黑
巴扎黑

reply all(1)
大家讲道理

下面是文档中对scatter的参数c的说明:
c : color, sequence, or sequence of color, optional, default: ‘b’
c can be a single color format string, or a sequence of color specifications of length N, or a sequence of N numbers to be mapped to colors using the cmap and norm specified via kwargs (see below). Note that c should not be a single numeric RGB or RGBA sequence because that is indistinguishable from an array of values to be colormapped. c can be a 2-D array in which the rows are RGB or RGBA, however, including the case of a single row to specify the same color for all points.

可见可以传入一个序列(list之类的)

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!