I've learned to not use seaborn if I need to make specific changes or detail oriented visualizations but I feel like I'm not fully utilizing what it has to offer at times.
- I have a series of 2D slices plotting cluster memberships.
- Issue is between the cases, the number of clusters present changes which causes seaborn to reset the color palette every case, leading to the same color being used for different clusters.
I'd like to specify the color palette specifically with seaborn. I'm not sure if I'm just missing something or if this is a detail that cannot be addressed when using facetgrid?
df = pd.DataFrame()
df['I'] = np.full(20,1)
df['J'] = np.arange(0,20,1)
df['K'] = [1]*12 + [2]*8
df['CM_Hard'] = [1]*10 + [2] + [0] + [2]*8
df['Realization'] = ['p25']*10 + ['p50']*9 + ['p75']
for layer in df['K'].unique():
layer_data_slice = df.groupby('K').get_group(layer)
g = sns.FacetGrid(layer_data_slice, col="Realization",hue="CM_Hard")
g.map_dataframe(sns.scatterplot, x="I", y="J", s=50, marker='+', palette='deep')
g.add_legend()
g.fig.suptitle("Training Realizations, Layer: {}".format(int(layer)), size=16, y=1.05)
figure_title = 'Training_Layer_{}'.format(int(layer))
I've attempted to use the following for the palette definition but it does not affect the plots:
palette = {0:"tab:cyan", 1:"tab:orange", 2:"tab:purple"}
This has been attempted with "tab:color", "color" and the RGB reference with no luck. There is no error it simply doesn't do anything when changed.