iterating markers in plots

前端 未结 2 1259
挽巷
挽巷 2020-12-02 00:36

I\'m trying to denote the predictions with a color and the correct labels as markers for the iris data set. Here is what I have so far:

from sklearn.mixture          


        
2条回答
  •  眼角桃花
    2020-12-02 01:13

    You could modify your code like the following to get the desired result:

    markers = ["o" , "s" , "D"]
    colors = ["red", "green", "blue"]
    
    for i in range(4):
        for j in range(4):
            for k in range(x.shape[0]):
                if(i != j):
                    axes[i, j].scatter(x[k, i], x[k, j], color=colors[labels[k]], marker = markers[y[k]], s=40, cmap='viridis')  
                else:
                    axes[i,j].text(0.15, 0.3, Superman[i], fontsize = 8)
    

提交回复
热议问题