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 🎉.

Contact & Edit


👋 This document is a work by Yan Holtz. You can contribute on github, send me a feedback on twitter or subscribe to the newsletter to know when new examples are published! 🔥

This page is just a jupyter notebook, you can edit it here. Please help me making this website better 🙏!