What is Seaborn, how to install and use
Seaborn basics
3 min read
Published Oct 7 2025, updated Aug 17 2026
Guide Sections
Guide Comments
Seaborn Official Documentation
This guide only goes through the basics. Seaborn is capable of much more, visit the official site for more details.
Seaborn is a Python data visualisation library built on top of Matplotlib.
It provides a high-level interface for creating beautiful and informative statistical graphics with minimal code.
How does it differ from Matplotlib
Matplotlib:
- You manually provide raw data for every element (bars, lines, markers, etc.).
- No automatic statistical handling — if you want something like:
- regression lines,
- confidence intervals,
- grouped summaries —
you must compute them yourself (using NumPy, SciPy, or Pandas) and plot them manually. - Styling defaults are basic, so you often spend time adjusting colours, grids, legends, and layouts.
- Maximum control: you can tweak every visual element, which makes it perfect for highly customized or publication-grade figures.
Seaborn:
- Built on top of Matplotlib — everything you do in Seaborn ultimately uses Matplotlib under the hood.
- DataFrame-native: you pass in a Pandas DataFrame and just specify column names for variables (
x,y,hue, etc.) — no manual slicing or array management. - Smart defaults: it automatically applies attractive styles, consistent colour palettes, and clean layouts.
- Statistical intelligence built-in: things like regression lines, confidence intervals, or data aggregation are automatic or can be toggled with simple parameters (e.g.
sns.lmplot(),sns.barplot()). - Still customisable: after plotting with Seaborn, you can further modify the figure using Matplotlib commands (titles, annotations, subplots, etc.).
Categories of Seaborn Charts
1. Relational Plots (relationships between variables) - used to visualise how variables relate to each other.
sns.scatterplot()– scatter plotssns.lineplot()– line charts (with confidence bands)sns.relplot()– wrapper to create multiple relational plots (facet grids)
2. Categorical Plots (comparing groups) - used to compare values across discrete categories.
sns.barplot()– bar plot with confidence intervalssns.countplot()– bar plot for countssns.boxplot()– box-and-whisker plotsns.violinplot()– box + density shapesns.stripplot()– jittered scatter of observationssns.swarmplot()– non-overlapping scatter pointssns.catplot()– a flexible “master” function to create any of the above with faceting
3. Distribution Plots (data spread and shape) - used to show how values are distributed.
sns.histplot()– histogramsns.kdeplot()– kernel density estimate (smoothed histogram)sns.ecdfplot()– empirical cumulative distributionsns.displot()– flexible wrapper for hist/KDE plotssns.rugplot()– tick marks for raw data points
4. Regression & Statistical Relationship Plots - show relationships with regression fitting.
sns.regplot()– scatter + regression linesns.lmplot()– regression across subsets (faceting, colour, etc.)
5. Matrix & Heatmap Plots - used for showing tabular or correlation data.
sns.heatmap()– visualises 2D matrices or correlation matricessns.clustermap()– heatmap with hierarchical clustering
6. Multi-Variable (Grid) Plots - for visualising multi-dimensional relationships.
sns.pairplot()– scatterplot matrix of all variable pairssns.jointplot()– scatter + histograms on marginssns.PairGrid()/sns.FacetGrid()– build custom multi-panel grids
Installation
pip install seabornImporting the library
import seaborn as snsBy convention, it’s always imported as sns.
Sample datasets
Seaborn comes with a collection of built-in example datasets that are very handy for learning, testing, and demoing plots.
View available datasets:
import seaborn as snsprint(sns.get_dataset_names())Load a dataset by name:
tips = sns.load_dataset('tips')Loads the dataset called tips, replace tips with any other of the available dataset names.