Rug plot
Seaborn basics
2 min read
Published Oct 7 2025
Guide Sections
Guide Comments
seaborn.rugplot() draws small tick marks (rugs) along an axis to represent individual data points.
Each tick represents one observation — giving a sense of the distribution of data along a single dimension.
It’s often used:
- On its own for simple data density visualisation, or
- As an addition to other plots (e.g.,
histplot(),kdeplot()) to show the actual observations behind a smooth curve.
Syntax:
Parameters:
data= DataFrame containing the datax,y= Variables to plot (usually one)hue= Adds subgroups (coloured rugs)height= Length of each rug line (fraction of axis)expand_margins= Expands axis limits to fit the rugspalette= Colour palette for hue groupslinewidth= Thickness of each rug tickalpha= Transparency (0–1)ax= Axis to plot on (if combining with other plots)
Basic example
Each small vertical tick represents one observation of total_bill. The density of ticks gives a quick sense of data concentration.

Horizontal orientation
Plots rug ticks along the y-axis instead of x.

Add hue (subgroups)
Different colours represent different categories (e.g., Male vs. Female). Overlapping colours show how groups overlap in data distribution.

Customize rug appearance
Taller and thicker ticks make the rug more visible.

Overlay rug on other plots
On a Histogram:
The rugplot shows exact data points below the histogram bars.

On a KDE Plot:
Combines smooth distribution (KDE) with exact data locations (rug).

Bivariate rugplot (x and y)
Adds small ticks on both the x- and y-axes, showing marginal distributions.

Hue with multiple variables
Coloured rugs along both axes for each group.















