Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

manipulate sns legend

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)
Comment

PREVIOUS NEXT
Code Example
Python :: python access to vraiable in another classe 
Python :: python code to find duplicate row in sqlite database 
Python :: kaggle replace 
Python :: k means em algorithm program in python 
Python :: Python NumPy asfarray Function Syntax 
Python :: Python NumPy asarray_chkfinite Function Example Raises Value Error 
Python :: Python NumPy vstack Function Example with 2d array 
Python :: python solve how to find only real values 
Python :: python locateonscreen method 
Python :: Python NumPy vsplit Function 
Python :: Stacked or grouped bar char python 
Python :: __div__ 
Python :: python cos not the same as calculator 
Python :: simpy 
Python :: saving specific column with pd 
Python :: python subprocess redirect a file 
Python :: using .get() for deep dictionary 
Python :: adjoint of 3x3 matrix in python 
Python :: Remove Brackets from List Using for loop 
Python :: how to process numerical data machine learning 
Python :: python get dataframe vlaues where cell is higher than 
Python :: function multiply(a b) 
Python :: pyqt serial plotter 
Python :: Repetition in code for routes in Flask (or Bottle) 
Python :: get type of enum variable python 
Python :: np sign no 0 
Python :: ring Using Lists during definition 
Python :: list duplicate files in folder python 
Python :: StandardScaler sklearn get params normalization 
Python :: tkinter trig calculator 
ADD CONTENT
Topic
Content
Source link
Name
5+5 =