Python matplotlib scatter - different markers in one scatter

后端 未结 2 1803
时光取名叫无心
时光取名叫无心 2020-12-06 14:22

I want to display some points. Here is my code:

plt.scatter(y[:,0],y[:,1],c=col)
plt.show()

And as col I have:



        
2条回答
  •  抹茶落季
    2020-12-06 15:04

    Matplotlib does not support different markers in one call to scatter. You'll have to use two different calls to scatter; for example:

    plt.scatter(y[col == 0, 0], y[col == 0, 1], marker='o')
    plt.scatter(y[col == 1, 0], y[col == 1, 1], marker='+')
    

提交回复
热议问题