python的scatter中color為什么不能設(shè)置每個(gè)點(diǎn)的顏色
問(wèn)題描述
plt.scatter(x=rw.x_value,y=rw.y_value,c=point_number,colormap=plt.cm.Blues,gecolors=’none’,s=15)
其中point_number是指的一系列的點(diǎn),然后用range()生成的一個(gè)數(shù)字列表,并且使用顏色映射,但是在運(yùn)行的時(shí)候,報(bào)錯(cuò)ValueError: Invalid RGBA argument: 0用的是python3我想問(wèn)一下scatter里面的color參數(shù)到底如何能夠設(shè)置每個(gè)點(diǎn)
問(wèn)題解答
回答1:下面是文檔中對(duì)scatter的參數(shù)c的說(shuō)明: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.
可見可以傳入一個(gè)序列(list之類的)
相關(guān)文章:
1. docker-compose中volumes的問(wèn)題2. boot2docker無(wú)法啟動(dòng)3. 關(guān)docker hub上有些鏡像的tag被標(biāo)記““This image has vulnerabilities””4. nignx - docker內(nèi)nginx 80端口被占用5. java - SSH框架中寫分頁(yè)時(shí)service層中不能注入分頁(yè)類6. docker安裝后出現(xiàn)Cannot connect to the Docker daemon.7. javascript - mock.js可以存儲(chǔ)數(shù)據(jù)嗎8. golang - 用IDE看docker源碼時(shí)的小問(wèn)題9. docker api 開發(fā)的端口怎么獲取?10. dockerfile - 為什么docker容器啟動(dòng)不了?

網(wǎng)公網(wǎng)安備