I have a subplot including a sns.scatterplot
that needs to differentiate 2 characteristics:
fig,ax= plt.subplots(figsize=(16/2.54,7/2.54),ncols=2,sharey=True)sns.scatterplot(data=df,x='size',y='width_tot', hue='name_short',style='color',ax=ax[1])
The legend now offers the following entries:
name_short* name12* name45color* c+ r* g
As you can see, the names of my dataframes are more of "working-names" rather than ones I want to see in my plot. In contrast, when replacing the seaborn function of hue and style, I lose important information of my plot. So my question would be how I can overwrite the legend-entries e.g. the legend titles and the hue-entries, as I could live with the short forms of colors.
The following attempt did not bring the solution, overwriting the whole legend neither, as I am losing the symbols of the style differentiation.
legend_titles = ['Clear Name 1', 'Clear Name 2']legend = ax[1].legend()for i, title in enumerate(legend_titles): legend.get_texts()[i].set_text(title)