1

I'm trying to increase the size of the markers in a seaborn pairplot legend. The plot without any attempted scaling:

enter image description here

df:

a   b   c
0   1   0   0
1   0   1   0
2   0   0   1
3   1   0   0
se = pd.Series(list('abca'))
df = pd.get_dummies(se)
display(df)
ax=sns.pairplot(df,vars=['a','b','c'], hue='c',palette=sns.color_palette(sns.hls_palette(8, l=.4, s=.8), len(np.unique(df['a']))))
ax.fig.legend(markerscale=2)

The code above gives the following result, which is obviously not correct. enter image description here

I also tried with adding ,plot_kws={'s':50}, but that scaled both the points in the legend AND the points inside the plot, which I do not want.

ax=sns.pairplot(df,vars=['a','b','c'], hue='c',palette=sns.color_palette(sns.hls_palette(8, l=.4, s=.8), len(np.unique(df['a']))),plot_kws={'s':50})

enter image description here

meerkat
  • 932
  • 2
  • 14
  • 38
  • Can you try adding "plot_kws=3" parameter in the sns.pairplot function? – Rishabh Gupta May 26 '20 at 16:32
  • Try: `,plot_kws={'s':50}` as an additional keyword argument to `sns.pairplot()` – mechanical_meat May 26 '20 at 16:57
  • That changes the size of the internal points as well. I only want to change the size of the legend markers. @mechanical_meat – meerkat May 27 '20 at 07:09
  • 2
    https://stackoverflow.com/questions/48694620/how-to-set-legend-marker-size-and-alpha is the solution for anyone wandering. – meerkat May 27 '20 at 07:24
  • First, this question is not a duplicate as indicated above, as it is about the markers, and second, the lmplot version does not work for pairplot. Or the API has changed. – Soerendip Dec 03 '21 at 23:09

0 Answers0