aaanalysis.plot_get_clist
- aaanalysis.plot_get_clist(n_colors=3)[source]
Get a manually curated list of 2 to 9 colors or ‘husl’ palette for more than 9 colors.
This functions returns one of eight different color lists optimized for appealing visualization of categories. If more than 9 colors are selected,
seaborn.color_palette()with ‘husl’ palette will be used.Added in version 0.1.2.
- Parameters:
n_colors (int, default=3) – Number of colors. Must be greater 2.
- Returns:
Color list given as matplotlib color names.
- Return type:
See also
The example notebooks in Plotting Prelude.
seaborn.color_palette()function to generate a color palette in seaborn.
Examples
You can retrieve a list of n colors by using the
n_colorsparameter:import matplotlib.pyplot as plt import seaborn as sns import aaanalysis as aa colors = aa.plot_get_clist(n_colors=2) sns.palplot(colors) plt.show()
We assembled 8 different color lists for 2 to 9 colors:
for n in range(3, 9): colors = aa.plot_get_clist(n_colors=n) sns.palplot(colors) plt.show()
For more than 9 colors, we provide the ‘husl’ default color palette of the :func:
seaborn.color_palettefunction:for n in [10, 15, 20]: colors = aa.plot_get_clist(n_colors=n) sns.palplot(colors) plt.show()