Home > OS >  How to set colours with big contrast on Matplotlib scatter plot
How to set colours with big contrast on Matplotlib scatter plot

Time:01-19

I want to plot scatter plot of my clusters. I have done it with this:

figure(figsize=(22, 25), dpi = 80)
plt.scatter(reduced_features[:, 0], reduced_features[:,1], c = kmeans.predict(vec_matrix_pca), s = 7)
plt.scatter(reduced_cluster_centers[:, 0], reduced_cluster_centers[:, 1], marker = 'x', s = 120, c = 'r')
plt.grid()
plt.show()

This is the result:

enter image description here

The thing is, as you see, it is very hard to make a difference between clusters. How can I select different color map, or colours with bigger contrast. FYI, I have 150 clusters.

CodePudding user response:

You can use plt.style.use(style_name) to set the style sheet. Available style sheets with examples can be found here.

  • Related