seaborn
Statistical data visualization library built on matplotlib with dataframe-aware plotting functions.
Official Documentation ↗seaborn 0.13+ / Python 3.9+ / 依赖 matplotlib. Check the official docs for the latest API surface.Installation
pip install seabornMethods
No methods match this filter.
Overview
seaborn layers statistical plotting on matplotlib: it understands dataframes, maps columns to visual channels, and applies attractive defaults while still returning matplotlib objects.
Core Methods
Figure-level functions like displot and catplot manage their own layout, while axes-level functions like scatterplot and boxplot draw onto an axes you can embed in a matplotlib figure.
Usage Notes
Use set_theme for consistent styling, pass tidy dataframes directly, and combine seaborn for the statistical layers with matplotlib for fine detail. Switch to axes-level functions when composing subplots.
Common Pitfalls
Passing wide data to functions expecting long data scrambles the mapping. Setting rcParams after plotting has no effect on existing figures. Heavy faceting without size control produces unreadable output.
API reference evidence
Fetched from official sources on 2026-11-08T09:53:13.312Z via WebFetch https://seaborn.pydata.org/generated/seaborn.set_theme.html.
seaborn.set_theme→ signature from https://seaborn.pydata.org/generated/seaborn.set_theme.html; official text: “seaborn.set_theme(context=‘notebook’, style=‘darkgrid’, palette=‘deep’, font=‘sans-serif’, font_scale=1, color_codes=True, rc=None)”seaborn.scatterplot→ signature from https://seaborn.pydata.org/generated/seaborn.scatterplot.html; official text: “seaborn.scatterplot(data=None, *, x=None, y=None, hue=None, size=None, style=None, palette=None, hue_order=None, hue_norm=None, sizes=None, size_order=None, size_norm=None, markers=True, style_order=None, legend=‘auto’, “seaborn.boxplot→ signature from https://seaborn.pydata.org/generated/seaborn.boxplot.html; official text: “seaborn.boxplot(data=None, *, x=None, y=None, hue=None, order=None, hue_order=None, orient=None, color=None, palette=None, saturation=0.75, fill=True, dodge=‘auto’, width=0.8, gap=0, whis=1.5, linecolor=‘auto’, linewidth”
FAQ
- How does seaborn relate to matplotlib?
- Seaborn wraps matplotlib, providing dataframe-aware functions and themes while returning matplotlib axes you can further customize with matplotlib calls.
- What is long versus wide data?
- Most seaborn functions expect tidy long data where each row is an observation. Use melt to convert wide tables into long form before plotting.
- How do I control figure size?
- Pass a figure-level function such as displot with height and aspect, or create a matplotlib figure first and pass ax to axes-level functions.
Report a problem with this API docOpens a pre-filled issue on GitHub.