Categorical plot

Seaborn basics

2 min read

Published Oct 7 2025, updated Aug 17 2026


24
0
0
0

ChartsGraphsMatplotlibNumPyPandasPythonSeabornVisualisation

seaborn.catplot() is a high-level figure-level function for creating categorical plots in Seaborn.
It combines the features of several categorical plotting functions — like:

  • sns.stripplot()
  • sns.swarmplot()
  • sns.boxplot()
  • sns.violinplot()
  • sns.barplot()
  • sns.countplot()

…and adds faceting support (multiple subplots based on data subsets).

Essentially, catplot() = categorical plot + easy subplotting (faceting).


Syntax:

sns.catplot(    data=None,    x=None,    y=None,    hue=None,    kind="strip",    col=None,    row=None,    order=None,    hue_order=None,    col_order=None,    row_order=None,    height=5,    aspect=1,    palette=None,    orient=None,    dodge=True,    legend=True,    margin_titles=False,    **kwargs)

Parameters:

  • data = DataFrame containing your data
  • x, y = Categorical and numerical variables
  • hue = Adds subgroups (coloured)
  • kind = Type of categorical plot to draw ("strip", "swarm", "box", "violin", "bar", "count", "boxen")
  • col, row = Variables for faceting (creating subplots)
  • order, hue_order = Category ordering
  • palette = Colour scheme
  • height = Height (in inches) of each subplot
  • aspect = Width = height × aspect
  • orient = "v" (vertical) or "h" (horizontal)
  • dodge = Separate hue categories
  • legend = Show or hide legend
  • margin_titles = Add titles on the edges of facets




Basic example

import seaborn as snsimport matplotlib.pyplot as plt​tips = sns.load_dataset("tips")​sns.catplot(data=tips, x="day", y="total_bill", kind="box")plt.show()

Creates a boxplot showing the distribution of total_bill for each day.


seaborn cat plot basic example





Kinds of categorical plots

Kind

What It Shows

Equivalent Function

"strip"

Individual data points (with possible jitter)

sns.stripplot()

"swarm"

Non-overlapping points

sns.swarmplot()

"box"

Summary statistics (quartiles, median, outliers)

sns.boxplot()

"violin"

Distribution + density + quartiles

sns.violinplot()

"boxen"

Enhanced boxplot for large datasets

sns.boxenplot()

"bar"

Aggregated values (mean + CI)

sns.barplot()

"count"

Counts of each category

sns.countplot()

You can switch kind to change the plot type — no need to rewrite code.






Faceting: split data into subplots

Faceting = multiple subplots based on different subsets of your data.


Facet by Column:

import seaborn as snsimport matplotlib.pyplot as plt​tips = sns.load_dataset("tips")​sns.catplot(    data=tips,    x="day",    y="total_bill",    hue="sex",    col="smoker",    kind="box",    palette="Set2")plt.show()

Creates one subplot for smokers and one for non-smokers.


seaborn cat plot col example


Facet by Row:

import seaborn as snsimport matplotlib.pyplot as plt​tips = sns.load_dataset("tips")​sns.catplot(    data=tips,    x="day",    y="total_bill",    hue="sex",    row="time",    kind="violin",    palette="pastel")plt.show()

One row for Lunch and one for Dinner.


seaborn cat plot row example





Facet by both row and column

import seaborn as snsimport matplotlib.pyplot as plt​tips = sns.load_dataset("tips")​sns.catplot(    data=tips,    x="day",    y="total_bill",    hue="sex",    col="smoker",    row="time",    kind="box",    palette="coolwarm")plt.show()

Grid of subplots by both smoker and time.


seaborn cat plot row and col example
© 2025 SimpleSteps.guide
AboutFAQPoliciesContact