title: How can I specify the color of the kmeans clusters in 3D plot (Pandas)?
body: <p>I couldn't plot the figure with the desired colored cluster.
  Every dot belongs to a specific cluster and hence there should be specific color for each cluster but as shown in figure, I could not get the desired color. how can I modify the code to get the expected result and a nice cluster. </p>
  
  <pre><code>pca_ = PCA(n_components=3)
  X_Demo_fit_pca = pca_.fit_transform(Demo_df_Processed)
  
  kmeans_PCA = KMeans(n_clusters=4, init='k-means++', max_iter= 300, n_init= 10, random_state= 3)
  
  y_kmeans_PCA = kmeans_PCA.fit_predict(X_Demo_fit_pca)
  y_kmeans_PCA
  Demo_df_Processed.head()
  
  
  
  fig = plt.figure()
  ax = fig.add_subplot(111, projection='3d')
  ax.scatter(X_Demo_fit_pca[:,0],X_Demo_fit_pca[:,1],X_Demo_fit_pca[:,2], c=y,
              edgecolor='k', s=40, alpha = 0.5)
  
  
  
  ax.set_title("First three PCA directions")
  ax.set_xlabel("Educational_Degree")
  ax.set_ylabel("Gross_Monthly_Salary")
  ax.set_zlabel("Claim_Rate")
  ax.dist = 10
  
  ax.scatter(kmeans.cluster_centers_[:,0], kmeans.cluster_centers_[:,1], kmeans.cluster_centers_[:,2], 
             s = 100, c = 'r', label = 'Centroid')
  
  plt.autoscale(enable=True, axis='x', tight=True)
  
  
  plt.show()
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/9LTmX.png" rel="nofollow noreferrer">Kmeans Clustering Image</a></p>