What is Seaborn, how to install and use

Seaborn basics

3 min read

Published Oct 7 2025


24
0
0
0

ChartsGraphsMatplotlibNumPyPandasPythonSeabornVisualisation
website link icon

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 plots
  • sns.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 intervals
  • sns.countplot() – bar plot for counts
  • sns.boxplot() – box-and-whisker plot
  • sns.violinplot() – box + density shape
  • sns.stripplot() – jittered scatter of observations
  • sns.swarmplot() – non-overlapping scatter points
  • sns.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() – histogram
  • sns.kdeplot() – kernel density estimate (smoothed histogram)
  • sns.ecdfplot() – empirical cumulative distribution
  • sns.displot() – flexible wrapper for hist/KDE plots
  • sns.rugplot() – tick marks for raw data points

4. Regression & Statistical Relationship Plots - show relationships with regression fitting.

  • sns.regplot() – scatter + regression line
  • sns.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 matrices
  • sns.clustermap() – heatmap with hierarchical clustering

6. Multi-Variable (Grid) Plots - for visualising multi-dimensional relationships.

  • sns.pairplot() – scatterplot matrix of all variable pairs
  • sns.jointplot() – scatter + histograms on margins
  • sns.PairGrid() / sns.FacetGrid() – build custom multi-panel grids





Installation

pip install seaborn





Importing the library

import seaborn as sns

By 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 sns

print(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.


Products from our shop

Docker Cheat Sheet - Print at Home Designs

Docker Cheat Sheet - Print at Home Designs

Docker Cheat Sheet Mouse Mat

Docker Cheat Sheet Mouse Mat

Docker Cheat Sheet Travel Mug

Docker Cheat Sheet Travel Mug

Docker Cheat Sheet Mug

Docker Cheat Sheet Mug

Vim Cheat Sheet - Print at Home Designs

Vim Cheat Sheet - Print at Home Designs

Vim Cheat Sheet Mouse Mat

Vim Cheat Sheet Mouse Mat

Vim Cheat Sheet Travel Mug

Vim Cheat Sheet Travel Mug

Vim Cheat Sheet Mug

Vim Cheat Sheet Mug

SimpleSteps.guide branded Travel Mug

SimpleSteps.guide branded Travel Mug

Developer Excuse Javascript - Travel Mug

Developer Excuse Javascript - Travel Mug

Developer Excuse Javascript Embroidered T-Shirt - Dark

Developer Excuse Javascript Embroidered T-Shirt - Dark

Developer Excuse Javascript Embroidered T-Shirt - Light

Developer Excuse Javascript Embroidered T-Shirt - Light

Developer Excuse Javascript Mug - White

Developer Excuse Javascript Mug - White

Developer Excuse Javascript Mug - Black

Developer Excuse Javascript Mug - Black

SimpleSteps.guide branded stainless steel water bottle

SimpleSteps.guide branded stainless steel water bottle

Developer Excuse Javascript Hoodie - Light

Developer Excuse Javascript Hoodie - Light

Developer Excuse Javascript Hoodie - Dark

Developer Excuse Javascript Hoodie - Dark

© 2025 SimpleSteps.guide
AboutFAQPoliciesContact