v0.12.0 (September 2022)#
Introduction of the objects interface#
This release debuts the
seaborn.objects interface, an entirely new approach to making plots with seaborn. It is the product of several years of design and 16 months of implementation work. The interface aims to provide a more declarative, composable, and extensible API for making statistical graphics. It is inspired by Wilkinson’s grammar of graphics, offering a Pythonic API that is informed by the design of libraries such as
vega-lite along with lessons from the past 10 years of seaborn’s development.
This initial release should be considered “experimental”. While it is stable enough for serious use, there are definitely some rough edges, and some key features remain to be implemented. It is possible that breaking changes may occur over the next few minor releases. Please be patient with any limitations that you encounter and help the development by reporting issues when you find behavior surprising.
Seaborn’s plotting functions now require explicit keywords for most arguments, following the deprecation of positional arguments in v0.11.0. With this enforcement, most functions have also had their parameter lists rearranged so that
data is the first and only positional argument. This adds consistency across the various functions in the library. It also means that calling
func(data) will do something for nearly all functions (those that support wide-form data) and that
pandas.DataFrame can be piped directly into a plot. It is possible that the signatures will be loosened a bit in future releases so that
y can be positional, but minimal support for positional arguments after this change will reduce the chance of inadvertent mis-specification (#2804).
Modernization of categorical scatterplots#
This release begins the process of modernizing the categorical plots, beginning with
swarmplot(). These functions are sporting some enhancements that alleviate a few long-running frustrations (#2413, #2447):
Feature The new
native_scaleparameter allows numeric or datetime categories to be plotted with their original scale rather than converted to strings and plotted at fixed intervals.
Feature The new
formatterparameter allows more control over the string representation of values on the categorical axis. There should also be improved defaults for some types, such as dates.
Enhancement It is now possible to assign
huewhen using only one coordinate variable (i.e. only
Enhancement It is now possible to disable the legend.
The updates also harmonize behavior with functions that have been more recently introduced. This should be relatively non-disruptive, although a few defaults will change:
Defaults The functions now hook into matplotlib’s unit system for plotting categorical data. (Seaborn’s categorical functions actually predate support for categorical data in matplotlib.) This should mostly be transparent to the user, but it may resolve a few edge cases. For example, matplotlib interactivity should work better (e.g., for showing the data value under the cursor).
Defaults A color palette is no longer applied to levels of the categorical variable by default. It is now necessary to explicitly assign
hueto see multiple colors (i.e., assign the same variable to
huewill continue to be honored for one release cycle.
huevariables now receive a continuous mapping by default, using the same rules as
palette="deep"to reproduce previous defaults.
Defaults The plots now follow the default property cycle; i.e. calling an axes-level function multiple times with the same active axes will produce different-colored artists.
API Currently, assigning
hueand then passing a
colorwill produce a gradient palette. This is now deprecated, as it is easy to request a gradient with, e.g.
Similar enhancements / updates should be expected to roll out to other categorical plotting functions in future releases. There are also several function-specific enhancements:
swarmplot(), the order of the points in each swarm now matches the order in the original dataset; previously they were sorted. This affects only the underlying data stored in the matplotlib artist, not the visual representation (#2443).
More flexible errorbars#
With the new
errorbar parameter, it is now possible to select bootstrap confidence intervals, percentile / predictive intervals, or intervals formed by scaled standard deviations or standard errors. The parameter also accepts an arbitrary function that maps from a vector to an interval. There is a new user guide chapter demonstrating these options and explaining when you might want to use each one.
Feature Made it easier to customize
JointGridwith a fluent (method-chained) style by adding
pipemethods. Additionally, fixed the
reflinemethods so that they return
Fix Improved integration with the matplotlib color cycle in most axes-level functions (#2449).
Fix Fixed a regression in 0.11.2 that caused some functions to stall indefinitely or raise when the input data had a duplicate index (#2776).
Fix Added a workaround for a matplotlib issue that caused figure-level functions to freeze when
plt.showwas called (#2925).
scipyan optional dependency and added
pip install seaborn[stats]as a method for ensuring the availability of compatible
statsmodelslibraries at install time. This has a few minor implications for existing code, which are explained in the Github pull request (#2398).
Build Example datasets are now stored in an OS-specific cache location (as determined by
appdirs) rather than in the user’s home directory. Users should feel free to remove
~/seaborn-dataif desired (#2773).
Build The unit test suite is no longer part of the source or wheel distribution. Seaborn has never had a runtime API for exercising the tests, so this should not have workflow implications (#2833).
Build Following NEP29, dropped support for Python 3.6 and bumped the minimally-supported versions of the library dependencies.
API Removed the previously-deprecated
factorplotalong with several previously-deprecated utility functions (
API Removed the (previously-unused) option to pass additional keyword arguments to