Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

How to Add a Title to Seaborn Plots

# import pandas library
import pandas as pd
from pyparsing import line
import seaborn as sns
import matplotlib.pyplot as plt

# create pandas DataFrame
df = pd.DataFrame({'team': ['India', 'South Africa', 'New Zealand', 'England'],
                   'points': [10, 8, 3, 5],
                   'runrate': [0.5, 1.4, 2, -0.6],
                   'wins': [5, 4, 2, 2]})

# plot the data frame
line_plt = sns.lineplot(data = df)
line_plt.set(title = "ICC World Cup Standings")
plt.show()
Comment

seaborn set title

# plot the data
lineplt = sns.lineplot(x= 'column_x', y="column_y", data=dataframe)
# Creating seaborn Title
lineplt.set(title = 'Your Title')
plt.show()
Comment

How to Add a overall Title to Seaborn Plots

Add overall title to seaborn using suptitle() method
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt

# create pandas DataFrame
df = pd.DataFrame({'wins': [12, 11, 10, 3, 11, 20, 2, 30, 12,7],
                   'lost': [6, 4, 5, 3, 10, 7, 2, 12, 0, 6],
                   'team': ['A', 'A', 'A', 'A', 'A', 'B', 'B', 'B', 'B', 'B']})

# plot the data frame
rel = sns.relplot(data=df, x='wins', y='lost', col='team')

# add overall title
rel.fig.suptitle('ICC World Cup Standings')
plt.show()
Comment

PREVIOUS NEXT
Code Example
Python :: python utf 8 encoding 
Python :: read os.system output python 
Python :: remove non-alphabetic pandas python 
Python :: get role from name discord.py 
Python :: only keep few key value from dict 
Python :: discord.py set activity 
Python :: python print colored text 
Python :: dropdown in tkinter 
Python :: python check if port in use 
Python :: plot model 
Python :: log base 2 python 
Python :: df from numpy array 
Python :: python import from other folder outside folder 
Python :: using bs4 to obtain html element by id 
Python :: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools. 
Python :: how to append to every second item in list python 
Python :: order pandas dataframe by column values 
Python :: PRINT VS RETURN IN PYTHON 
Python :: reload all extensions discord.py 
Python :: python RuntimeWarning: overflow encountered in long_scalars 
Python :: current year in python 
Python :: python convert file into list 
Python :: how to find the calendar week python 
Python :: how to split an input in python by comma 
Python :: django foreign key field on delete do nothing 
Python :: r squared python 
Python :: pandas fillna with median of column 
Python :: get text between two strings python 
Python :: tkinter window to start maximized 
Python :: python how to unnest a nested list 
ADD CONTENT
Topic
Content
Source link
Name
2+7 =