seaborn
FreeNo executable scriptsNot checkedStatistical visualization with pandas integration. Use for quick exploration of distributions, relationships, and categorical comparisons with attractive defaul
About this skill
Seaborn Statistical Visualization
Overview
Seaborn is a Python visualization library for creating publication-quality statistical graphics. Use this skill for dataset-oriented plotting, multivariate analysis, automatic statistical estimation, and complex multi-panel figures with minimal code.
Environment and Installation
Current upstream documentation is for seaborn 0.13.2. Official docs support Python 3.8+ with mandatory NumPy, pandas, and matplotlib dependencies; scipy, statsmodels, and fastcluster are optional for some advanced statistics and clustering workflows.
# Reproducible install for examples in this skill
uv pip install "seaborn==0.13.2"
# Include optional statistical dependencies when needed
uv pip install "seaborn[stats]==0.13.2"
Recommended imports:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import seaborn.objects as so
sns.load_dataset() downloads public example data when it is not cached. For private, regulated, or offline work, load local files explicitly with pandas and pass the resulting DataFrame to seaborn.
Design Philosophy
Seaborn follows these core principles:
- Dataset-oriented: Work directly with DataFrames and named variables rather than abstract coordinates
- Semantic mapping: Automatically translate data values into visual properties (colors, sizes, styles)
- Statistical awareness: Built-in aggregation, error estimation, and confidence intervals
- Aesthetic defaults: Publication-ready themes and color palettes out of the box
- Matplotlib integration: Full compatibility with matplotlib customization when needed
Quick Start
import seaborn as sns
import matplotlib.pyplot as plt
import pandas as pd
# Load example dataset
df = sns.load_dataset('tips')
# Create a simple visualization
sns.scatterplot(data=df, x='total_bill', y='tip', hue='day')
plt.show()
Core Plotting Interfaces
Function Interface (Traditional)
The function interface provides specialized plotting functions organized by visualization type. Each category has axes-level functions (plot to single axes) and figure-level functions (manage entire figure with faceting).
When to use:
- Quick exploratory analysis
- Single-purpose visualizations
- When you need a specific plot type
Objects Interface (Modern)
The seaborn.objects interface provides a declarative, composable API similar to ggplot2. Build visualizations by chaining methods to specify data mappings, marks, transformations, and scales. Upstream still describes this interface as experimental and incomplete in 0.13.2, although stable enough for serious use; prefer the function interface for conservative production code unless the compositional API materially simplifies the plot.
When to use:
- Complex layered visualizations
- When you need fine-grained control over transformations
- Building custom plot types
- Programmatic plot generation
from seaborn import objects as so
# Declarative syntax
(
so.Plot(data=df, x='total_bill', y='tip')
.add(so.Dot(), color='day')
.add(so.Line(), so.PolyFit())
)
Current API Notes
Seaborn 0.12 and 0.13 changed several common plotting patterns:
- Most plotting functions now require keyword arguments for variables. Prefer
sns.scatterplot(data=df, x="x", y="y")over positionalsns.scatterplot(df["x"], df["y"]). errorbarreplaces the oldciparameter inlineplot(),barplot(), andpointplot(). Regression functions such asregplot()andlmplot()still useci.- Categorical plots were rewritten in 0.13. Use
native_scale=Truewhen numeric or datetime categories should keep their original scale instead of ordinal positions. - Passing
palettewithout assigninghueis deprecated for categorical functions. If each category should get its own color, assign a redundant hue such ashue="day"and setlegend=False. - Prefer renamed parameters:
violinplot(density_norm=..., common_norm=...)instead ofscale/scale_hue,boxenplot(width_method=...)instead ofscale, andbarplot(err_kws=...)instead oferrcolor/errwidth.
Plotting Functions by Category
Relational Plots (Relationships Between Variables)
Use for: Exploring how two or more variables relate to each other
scatterplot()- Display individual observations as pointslineplot()- Show trends and changes (automatically aggregates and computes CI)relplot()- Figure-level interface with automatic faceting
Key parameters:
x,y- Primary variableshue- Color encoding for additional categorical/continuous variablesize- Point/line size encodingstyle- Marker/line style encodingcol,row- Facet into multiple subplots (figure-level only)
# Scatter with multiple semantic mappings
sns.scatterplot(data=df, x='total_bill', y='tip',
hue='time', size='size', style='sex')
# Line plot with confidence intervals
sns.lineplot(data=timeseries, x='date', y='value', hue='category')
# Faceted relational plot
sns.relplot(data=df, x='total_bill', y='tip',
col='time', row='sex', hue='smoker', kind='scatter')
Distribution Plots (Single and Bivariate Distributions)
Use for: Understanding data spread, shape, and probability density
histplot()- Bar-based frequency distributions with flexible binningkdeplot()- Smooth density estimates using Gaussian kernelsecdfplot()- Empirical cumulative distribution (no parameters to tune)rugplot()- Individual observation tick marksdisplot()- Figure-level interface for univariate and bivariate distributionsjointplot()- Bivariate plot with marginal distributionspairplot()- Matrix of pairwise relationships across dataset
Key parameters:
x,y- Variables (y optional for univariate)hue- Separate distributions by categorystat- Normalization: "count", "frequency", "probability", "density"bins/binwidth- Histogram binning controlbw_adjust- KDE bandwidth multiplier (higher = smoother)fill- Fill area under curvemultiple- How to handle hue: "layer", "stack", "dodge", "fill"
# Histogram with density normalization
sns.histplot(data=df, x='total_bill', hue='time',
stat='density', multiple='stack')
# Bivariate KDE with contours
sns.kdeplot(data=df, x='total_bill', y='tip',
fill=True, levels=5, thresh=0.1)
# Joint plot with marginals
sns.jointplot(data=df, x='total_bill', y='tip',
kind='scatter', hue='time')
# Pairwise relationships
sns.pairplot(data=df, hue='species', corner=True)
Categorical Plots (Comparisons Across Categories)
Use for: Comparing distributions or statistics across discrete categories
Categorical scatterplots:
stripplot()- Points with jitter to show all observationsswarmplot()- Non-overlapping points (beeswarm algorithm)
Distribution comparisons:
boxplot()- Quartiles and outliersviolinplot()- KDE + quartile informationboxenplot()- Enhanced boxplot for larger datasets
Statistical estimates:
barplot()- Mean/aggregate with confidence intervalspointplot()- Point estimates with connecting linescountplot()- Count of observations per category
Figure-level:
catplot()- Faceted categorical plots (setkindparameter)
Key parameters:
x,y- Variables (one typically categorical)hue- Additional categorical groupingorder,hue_order- Control category orderingnative_scale- Preserve numeric/datetime scale on the categorical axislog_scale- Apply log scaling without dropping down to matplotlibformatter- Control categorical tick labelsdodge,gap- Separate hue levels side-by-side and space dodged elementsorient- "x"/"y" or "v"/"h" to specify the categorical axislegend- True/False or "auto", "brie
Install seaborn in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
Allowed tools
Tools this skill is permitted to call.
Read Write Edit BashBundled files
FAQ
What does the seaborn skill do?
Statistical visualization with pandas integration. Use for quick exploration of distributions, relationships, and categorical comparisons with attractive defaults. Best for box plots, violin plots, pair plots, heatmaps. Built on matplotlib. For interactive plots use plotly; for publication styling use scientific-visualization.
How do I install the seaborn skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the seaborn skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
Skill Creator
Author a new Agent Skill the right way
by Anthropictheme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with colors/fo
by Anthropictemplate-skill
Replace with description of the skill and when Claude should use it.
by Anthropicvercel-composition-patterns
vercel-composition-patterns — Agent Skill for Claude
by Vercel