Seaborn is a statistical data visualization library built on top of Matplotlib and integrated with Pandas DataFrames, providing a high-level interface for creating informative and attractive plots. It excels at making complex statistical plots simple to create, handling aggregation, estimation, and semantic mapping automatically. Understanding the distinction between axes-level and figure-level functions is essential: axes-level functions (like scatterplot, histplot, boxplot) plot onto a single Matplotlib axes and integrate seamlessly with subplots, while figure-level functions (like relplot, displot, catplot) create entire figures with FacetGrid objects, enabling automatic faceting across variables and consistent sizing. Seaborn v0.13 introduced a major overhaul of categorical plotting functions and added the native_scale and gap parameters across the board; v0.12 introduced the declarative objects interface (seaborn.objects) as an alternative to the classic functional API.
What This Cheat Sheet Covers
This topic spans 18 focused tables and 119 indexed concepts. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.
Table 1: Relational Plots
| Function | Example | Description |
|---|---|---|
sns.scatterplot(data=df, x='x', y='y', hue='category') | β’ Axes-level scatter plot showing relationship between two numeric variables β’ supports hue, size, and style for semantic grouping. | |
sns.lineplot(data=df, x='time', y='value', hue='group') | β’ Axes-level line plot emphasizing continuity β’ automatically aggregates multiple observations per x value and shows 95% confidence interval by default. |