Horje
sns histplot change legend labels Code Example
sns histplot change legend labels
import seaborn as sns

# load the tips dataset
tips = sns.load_dataset("tips")
# plot
g = sns.lmplot(x="total_bill", y="tip", hue="smoker", data=tips, markers=["o", "x"], facet_kws={'legend_out': True})
# title
new_title = 'My title'
g._legend.set_title(new_title)
# replace labels
new_labels = ['label 1', 'label 2']
for t, l in zip(g._legend.texts, new_labels):
    t.set_text(l)
default pairplot seaborn legend to control position
    g._legend.set_bbox_to_anchor((0.5, 0.5))




Python

Related
strptime() many format Code Example strptime() many format Code Example
Splitting strings in Python without split() Code Example Splitting strings in Python without split() Code Example
strftime python multiple formats Code Example strftime python multiple formats Code Example
Python int to binary string Code Example Python int to binary string Code Example
pandas calculate iqr Code Example pandas calculate iqr Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7