separate seaborn scatterplot legend from plot for high dimensional legend

260 views Asked by At

I have a seaborn python scatterplot with a legend that is too long to fit with the main plot. Is there a way to save the legend separately. I know it can be done if I used matplotlib.axes.scatter as in this gist but I would like to use seaborn as the representation is nicer.

%matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np

np.random.seed(7)

plt.figure(figsize=(16,10))
fig = sns.scatterplot(
    x="tsne-2d-one", 
    y="tsne-2d-two",
    hue="labels",
    palette=sns.color_palette("hls", 3995),
    data=df_subset,
    legend='brief',
    alpha=0.3,
)

any help would be appreciated

example image

0

There are 0 answers