Adding seaborn figures to subplots is usually done by passing 'ax' when creating the figure. For instance:
sns.kdeplot(x, y, cmap=cmap, shade=True, cut=5, ax=ax)
This method, however, doesn't apply to seaborn.palplot, which visualizes seaborn color palettes. My goal is to create a figure of different color palettes for scalable color comparison and presentation. This image roughly shows the figure I'm trying to create [source].
A possibly related answer describes a method of creating a seaborn figure and copying the axes to another figure. I haven't been able to apply this method to the palplot figures, and would like to know if there is a quick way to force them into the existing figure.
Here's my minimum working example, now still generating separate figures.
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
fig1 = plt.figure()
length, n_colors = 12, 50 # amount of subplots and colors per subplot
start_colors = np.linspace(0, 3, length)
for i, start_color in enumerate(start_colors):
ax = fig1.add_subplot(length, 1, i + 1)
colors = sns.cubehelix_palette(n_colors=n_colors, start=start_color,
rot=0, light=0.4, dark=0.8)
sns.palplot(colors)
plt.show(fig1)
Ultimately, to make the plot more informative, it would be great to print the RGB values stored in colors (list-like) evenly spaced over the palplots, but I don't know if this is easily implemented due to the unusual way of plotting in palplot.
Any help would be greatly appreciated!