我有一个大数据集,看起来像:
signature = [1,0,0,1,0,1] signature number may be 1,0 or -1
signature may change depending on point ID
[[ 1,2,3,4,5,6,signature,point id]
[ 1,2,3,4,5,6,signature,point id]
[ 1,2,3,4,5,6,signature,point id]
[ 1,2,3,4,5,6,signature,point id]
[ 1,2,3,4,5,6,signature,point id]
[ 1,2,3,4,5,6,signature,point id]
点看起来像:`[value1,value2,value3,value4,value5,value6,[签名],point_id]
我要根据点的坐标1和2绘制点 然后根据其签名(列表[1,0,0,1,0,1])提供颜色
如果我将第1列和第2列作为轴,则我只会查看签名上的第一个和第二个数字(签名[0]和签名[1])
这意味着我需要9种颜色才能实现9种组合: [0,0],[0,1],[0,-1],[1,0],[1,1],[1,-1],[-1,0],[-1,1 ],[-1,-1]
我成功地使每个点都具有二维图,但是我找不到一种根据其签名设置颜色的方法
例如
带有[1,0,“,”,“,”](“意味着1,0或-1”)的点将为红色
带有[0,1,“,”,“,”](“表示1,0或-1)的点将是蓝色的
具有[1,1,“,”,“,”](“表示1,0或-1)的点将变为绿色
具有[0,0,“,”,“,”](“表示1,0或-1”的点)将为黑色
for x in range(6):
for y in range(6):
if x != y:
plt.figure()
plt.scatter(data.T[x],data.T[y], s=50, linewidth=0,alpha=0.25)
plt.close()
目前,我的绘图上只有灰色点。 我试过了:
colors = np.where([data[7][x] = -1 and data[7][y] = -1],'0.5'
,np.where(data[7][x] = 1 and data[7][y] = -1,'g'
,np.where(data[7][x]=0 and data[7][y] = -1,'r'
,np.where(data[7][x] = -1 and data[7][y]] = 1,'c'
,np.where(data[7][x] = 1 and data[7][y] = 1,'m'
,np.where(data[7][x]=0 and data[7][y] = 1,'y'
,np.where(data[7][x] = -1 and data[7][y] = 1,'k'
,np.where(data[7][x] = 1 and data[7][y] = 1,'w'
,np.where(data[7][x]=0 and data[7][y] = 1,'b'
)))))))))
不起作用
但这只是手动组合,我想自动完成