Seaborn Titles

logo of a chart:Density

This blogpost provides a few tips and tricks concerning title addition and customization on a chart made with Python and the Seaborn library.

📕 Add a title

The following distribution chart is built thanks to the kdeplot() function of seaborn.

This function returns a matplotlib axes instance. Unlike pyplot itself, which has a method plt.title(), the corresponding argument for an axes is ax.set_title(). This is what you need to call to build the title:

# library & dataset
import seaborn as sns
df = sns.load_dataset('iris')

# Figure size
sns.set_theme(rc={'figure.figsize':(10,10)})

# Grey background
sns.set_theme(style="darkgrid")

# Make default density plot
ax = sns.kdeplot(df['sepal_width'])

# Add title
ax.set_title('A distribution chart made with Seaborn');

🎨 Title customization

Once you've understood how to add a title to a seaborn chart, customization works the same as for matplotlib. Visit this blopost to see many customization examples 🎉.

🚨 Grab the Data To Viz poster!


Do you know all the chart types? Do you know which one you should pick? I made a decision tree that answers those questions. You can download it for free!

    dataviz decision tree poster