Seaborn
raw JSON → 0.13.2 verified Tue May 12 auth: no python install: verified quickstart: verified
Seaborn is a high-level Python library for creating statistical graphics, building on Matplotlib and integrating closely with Pandas data structures. It provides a dataset-oriented API to draw attractive and informative statistical plots with ease. The library is actively maintained with regular minor and major releases, currently at version 0.13.2, ensuring compatibility with evolving data science ecosystems.
pip install seaborn Common errors
error AttributeError: 'AxesSubplot' object has no attribute 'distplot' ↓
cause The `distplot` function (or its replacements like `histplot` and `kdeplot`) is a top-level function in the `seaborn` module, not a method directly callable on a Matplotlib Axes object.
fix
Call
sns.distplot() directly, passing the ax parameter if you want to draw on a specific axes, or use the recommended sns.histplot or sns.kdeplot which support the ax parameter directly. error ValueError: cannot convert float NaN to integer ↓
cause This error commonly occurs in `seaborn.heatmap` when `annot=True` is used with a format string for integers (e.g., `fmt='d'`) while the underlying data contains `NaN` (Not a Number) values, which are floats and cannot be directly converted to integers.
fix
Handle
NaN values by either filling them (e.g., df.fillna(0)) or using a float format string (e.g., fmt='.1f' or fmt='g') with annot=True, or set annot=False if annotations are not strictly needed. error TypeError: kdeplot got an unexpected keyword argument 'shade' ↓
cause The `shade` parameter in `seaborn.kdeplot` was deprecated and subsequently removed in Seaborn versions 0.11.0 and later, replaced by the `fill` parameter.
fix
Replace
shade=True with fill=True when calling sns.kdeplot. error AttributeError: 'FacetGrid' object has no attribute 'set_title' ↓
cause Figure-level functions in Seaborn (like `sns.relplot`, `sns.catplot`, `sns.displot`, `sns.FacetGrid`) return a `FacetGrid` object, which is not a Matplotlib Axes object and thus does not have a `set_title` method; titles need to be set differently for figure-level plots.
fix
Use the
g.fig.suptitle() method for an overall figure title, or g.set_titles() to set titles for individual subplots within the FacetGrid. Warnings
breaking The `seaborn.objects` interface was introduced in v0.12.0, offering a new declarative API. While powerful, it's considered experimental and may have breaking changes or rough edges in early minor releases. ↓
fix Consult the official `seaborn.objects` documentation for specific usage and known limitations. For simpler plots or existing code, continue using the traditional axes-level and figure-level functions.
breaking Seaborn's categorical plotting functions (e.g., `boxplot`, `barplot`, `catplot`) underwent a major overhaul in v0.13.0. This includes changes to color defaults (now requiring explicit `hue` for multiple colors) and the introduction of the `native_scale` parameter. ↓
fix Review code using categorical plots. To reproduce previous color behavior, explicitly assign a redundant `hue` variable (e.g., `boxplot(data, x='x', y='y', hue='x')`). If mixing categorical and numerical data on an axis, consider `native_scale=True`.
deprecated Python 3.7 support was dropped in Seaborn v0.12.2. ↓
fix Upgrade to Python 3.8 or newer to ensure compatibility and receive future updates.
gotcha Positional arguments for most plotting functions were deprecated in v0.11.0 and enforced to be keyword-only in v0.12.0. This applies to arguments like `x`, `y`, `hue`, etc. ↓
fix Always pass arguments like `x`, `y`, `data` using explicit keywords (e.g., `sns.scatterplot(data=df, x='col1', y='col2')` instead of `sns.scatterplot(df, 'col1', 'col2')`).
gotcha A regression in v0.13.0 caused exceptions when working with non-NumPy data types (e.g., Pandas nullable dtypes), which was fixed in v0.13.1. Pandas dtypes can still sometimes cause issues as Matplotlib (and by extension, Seaborn) often expects NumPy dtypes. ↓
fix Update to Seaborn v0.13.1 or later. Ensure that data passed to Seaborn plotting functions are of appropriate (usually numerical) NumPy types, converting Pandas nullable dtypes explicitly if necessary (e.g., `.astype(float)`).
gotcha When combining categorical plots with other plot types (e.g., a bar plot and a line plot on the same axes), misalignment can occur because categorical plots internally map string/category values to integer indices. ↓
fix For Seaborn v0.13.0+, use `native_scale=True` in categorical plots if the categorical axis truly represents numeric or datetime data. For older versions or string categories, carefully manage axis limits and tick labels using Matplotlib to ensure alignment.
gotcha The test environment generated warnings or notices from `pip` related to running as the root user or an available update for `pip`. These are typically environment-specific messages from the package manager, not direct failures of the tested library. ↓
fix It is generally recommended to run `pip` in a virtual environment to avoid permission issues and system conflicts. To update `pip`, run `pip install --upgrade pip`. If running as root is intentional and understood, use `pip --root-user-action=ignore` to suppress the warning.
Install compatibility verified last tested: 2026-05-12
python os / libc status wheel install import disk
3.10 alpine (musl) wheel - 3.53s 253.9M
3.10 alpine (musl) - - 3.48s 253.6M
3.10 slim (glibc) wheel 11.4s 2.72s 243M
3.10 slim (glibc) - - 2.55s 242M
3.11 alpine (musl) wheel - 4.26s 274.7M
3.11 alpine (musl) - - 4.73s 274.3M
3.11 slim (glibc) wheel 11.0s 4.14s 262M
3.11 slim (glibc) - - 3.69s 262M
3.12 alpine (musl) wheel - 3.66s 258.4M
3.12 alpine (musl) - - 3.93s 258.0M
3.12 slim (glibc) wheel 10.9s 4.01s 245M
3.12 slim (glibc) - - 4.33s 245M
3.13 alpine (musl) wheel - 3.37s 257.2M
3.13 alpine (musl) - - 3.63s 256.7M
3.13 slim (glibc) wheel 11.0s 3.56s 244M
3.13 slim (glibc) - - 3.72s 243M
3.9 alpine (musl) wheel - 3.37s 257.8M
3.9 alpine (musl) - - 3.34s 257.6M
3.9 slim (glibc) wheel 13.6s 3.08s 249M
3.9 slim (glibc) - - 2.97s 249M
Imports
- seaborn
import seaborn as sns - seaborn.objects
import seaborn.objects as so
Quickstart verified last tested: 2026-04-24
import seaborn as sns
import matplotlib.pyplot as plt
sns.set_theme(style="darkgrid")
# Load an example dataset
tips = sns.load_dataset("tips")
# Create a scatter plot
sns.scatterplot(
data=tips,
x="total_bill",
y="tip",
hue="smoker",
style="time",
size="size"
)
plt.title("Total Bill vs. Tip by Smoker and Time")
plt.xlabel("Total Bill ($)")
plt.ylabel("Tip ($)")
plt.show()