国产成人精品亚洲777人妖,欧美日韩精品一区视频,最新亚洲国产,国产乱码精品一区二区亚洲

您的位置:首頁技術文章
文章詳情頁

python的scatter中color為什么不能設置每個點的顏色

瀏覽:117日期:2022-06-30 15:29:07

問題描述

plt.scatter(x=rw.x_value,y=rw.y_value,c=point_number,colormap=plt.cm.Blues,gecolors=’none’,s=15)

其中point_number是指的一系列的點,然后用range()生成的一個數字列表,并且使用顏色映射,但是在運行的時候,報錯ValueError: Invalid RGBA argument: 0用的是python3我想問一下scatter里面的color參數到底如何能夠設置每個點

問題解答

回答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之類的)

標簽: Python 編程
相關文章:
主站蜘蛛池模板: 榆林市| 晋江市| 牙克石市| 洮南市| 兰溪市| 惠来县| 山东| 梁平县| 绍兴市| 江西省| 洛宁县| 汕尾市| 龙里县| 江陵县| 永安市| 宁城县| 台南县| 堆龙德庆县| 巫山县| 云和县| 简阳市| 茂名市| 西宁市| 闵行区| 武隆县| 沙洋县| 濉溪县| 桑日县| 双鸭山市| 新蔡县| 遂宁市| 蕉岭县| 林周县| 金秀| 左贡县| 朝阳县| 青田县| 新昌县| 双流县| 侯马市| 南漳县|