Changing the Sea Plan Legend

I would like to change the label for the legend and the elements in the legend for this plot. Currently, the label for the legend is โ€œHeart,โ€ and the elements are 0 and 1. I would like to be able to change all this to something else, but I'm not sure how to do it. Here is what I still have.

sns.set_context("talk",font_scale=3)
ax =sns.pointplot(x="Heart", y="FirstPersonPronouns", hue="Speech", data=df)
ax.set(xlabel='Condition', ylabel='First Person Pronouns')
ax.set(xticklabels=["Control", "Heart"])

Any help would be appreciated! In addition, I assume that this is a given parameter, which I do not know about, is there a complete list of them? I can not find it in the documentation.

+4
source share
1 answer

( ), :

import seaborn as sns

tips = sns.load_dataset('tips')
ax = sns.pointplot(x='sex', y='total_bill', hue='time', data=tips)
leg_handles = ax.get_legend_handles_labels()[0]
ax.legend(leg_handles, ['Blue', 'Orange'], title='New legend')

enter image description here

+2

Source: https://habr.com/ru/post/1655271/


All Articles