X=[22,33,55,66,77,55,66,77,44,66,33] Y=[2,6,9,9,10,5,32,19,123,46,93]
列表=[0,1,2,3,4,0,5,6,7,0,8,9,10,0]
x和y是cordinate 列表表示算法输出序列
使用列表,我需要绘制不同的颜色,在本例中: 1,2,3,4——颜色 5、6、7——颜色B 8、9、10——彩色 或 一条连接路径的线: 0,1,2,3,4,0——线性 0,5,6,7,0--行B 0,8,9,10,0--行C
我试过这个密码
Xsolution = []
Ysolution = []
for i in range(len(list)):
Xsolution.append(X[list[i]])
Ysolution.append(Y[list[i]])
if list[i] == 0 :
plt.scatter(Xsolution, Ysolution, color=random_color())
Xsolution = []
Ysolution = []
我需要一个函数,每当list[I]为0时生成一个随机颜色
我从网上取了这个,然后把它改成我需要的
相关问题 更多 >
编程相关推荐