I want to make a colormap with many (in the order of hundreds) unique colors.
This code:
custom_palette = sns.color_palette("Paired", 12)
sns.palplot(custom_palette)
returns a palplot with 12 unique colors.
But this code:
custom_palette = sns.color_palette("Paired", 24)
sns.palplot(custom_palette)
returns a palplot with 12 unique colors, seemingly repeated twice.
How do I obtain 24 (or more) unique colors?
There is definitely a way to get what you want! Fortunately, Seaborn has the ability to read colorcet
palettes which have some nice options for getting a wider range of qualitative colors:
from sklearn.datasets import make_blobs
import colorcet as cc
import matplotlib.pyplot as plt
import seaborn as snsblobs, labels = make_blobs(n_samples=1000, centers=25, center_box=(-100, 100))
palette = sns.color_palette(cc.glasbey, n_colors=25)sns.scatterplot(x=blobs[:,0], y=blobs[:, 1], hue=labels, data=blobs, palette=palette)
plt.legend(ncol=5, bbox_to_anchor=(1, 1))
plt.show()
Results in the following graph with 25 distinct colors:
Hope this helps!