Seaborn color palettes are similar to matplotlib colormaps. Color can help you discover patterns in data and is an important visualization component. Seaborn has a wide range of color palettes, which I will try to visualize in this recipe.
import seaborn as sns import matplotlib.pyplot as plt import matplotlib as mpl import numpy as np from dautil import plotting
Use the following function that helps plot the palettes:
def plot_palette(ax, plotter, pal, i, label, ncol=1): n = len(pal) x = np.linspace(0.0, 1.0, n) y = np.arange(n) + i * n ax.scatter(x, y, c=x, cmap=mpl.colors.ListedColormap(list(pal)), s=200) plotter.plot(x,y, label=label) handles, labels = ax.get_legend_handles_labels() ax.legend(loc='best', ncol=ncol, fontsize=18)
Categorical palettes are useful for categorical data, for instance, gender or blood type. The following function plots some of...