I have 2D data that I clustered using EM algorithm with soft classification. There are 3 different clusters, therefore I have a probability vector with dimension (n_clusters, n_datapoints).
Now I'd like to plot the individual datapoints in a scatter plot and assign a certain color to each cluster. The color of each point is given according to the probability to be in each cluster and thus a mixture of the cluster colors.
All I could achieve by now is the following with red, green and blue cluster colors
by using the following lines of code:
for n in range(X.shape[0]):
color = np.array([P[0,n],P[1,n],P[2,n]])[np.newaxis]
plt.scatter(X[n,0],X[n,1],c=color)
How can I assign a different, specific color to each cluster? E.g. orange for class 0, blue for class 1, magenta for class 2.
cluster-analysis
, and notcluster-computing
(edited). - desertnaut