Adding title using set_title
set_title method takes a string as parameter which is title of plot.
Syntax
set_title(‘Title of plot’)
Example:
Python3
# import necessary packages import pandas as pd import seaborn as sns # create a dataframe temperature = pd.DataFrame({ 'Month' : [ 'Jan' , 'Feb' , 'Mar' , 'Apr' , 'May' , 'Jun' , 'Jul' , 'Aug' , 'Sep' , 'Oct' , 'Nov' , 'Dec' ], 'Avg_Temperatures' : [ 22 , 25 , 28 , 32 , 35 , 44 , 38 , 32 , 25 , 23 , 20 , 18 ]}) # plot a bar plot and add title using set_title plot = sns.barplot(x = 'Month' , y = 'Avg_Temperatures' , data = temperature).set_title( 'Monthly Avg Temperatures' ) |
Output
How to Add a Title to Seaborn Plots?
In this article, we will discuss how to add a title to Seaborn Plots in Python.