Announcing the release of seaborn 0.12
Today sees the 0.12 release of seaborn, a Python library for data visualization. This is a major release that introduces an entirely new API along with numerous enhancements to existing functionality. This post highlights some notable features; see the release notes for complete details.
Introducing the objects interface
The biggest news in this release is the debut of the seaborn.objects interface, an entirely new approach to specifying graphics in seaborn.
The objects interface is the product of several years of work designing and implementing an API that is more declarative, composable, and extensible.
Taking inspiration from Wilkinson’s grammar of graphics — and its implementation in libraries such as ggplot2 and vega-lite — the objects interface offers a collection of classes that can be flexibly combined to specify a wide range of statistical graphics.
Here is a simple example, showing how you would make a scatter plot with dots colored by a categorical variable:
Like seaborn’s existing functions, you can get a complete plot by specifying only a minimal amount of information: where the data is coming from and how it should be visualized.
But while the plotting functions achieve simplicity by constraining what you can do with them, the objects interface will let you accomplish a lot more.
The design aims to alleviate some pain points that have emerged over the past decade of seaborn’s development and use. Namely, it will support a more cohesive customization experience, allowing most operations to be expressed within a common interface and avoiding the need for users to consult the matplotlib documentation when polishing a plot.
As this is the first official release, there will no doubt be some rough edges, and some key features have yet to be implemented. But it is ready for broad use. To learn more, check out the new tutorial, which introduces key concepts and demonstrates various usage patterns.
Enhancements to existing functionality
Not interested in the new interface? That’s OK: the existing functions aren’t going anywhere. While the focus is on the completely new tools, there are also a number of enhancements and fixes to the old ones.
These enhancements include some long-desired features, like a much more flexible approach to specifying error bars (complete with a new tutorial). The categorical scatterplot functions (stripplot and swarmplot) have been refactored: their default behavior is now more consistent with the rest of the library, and they’re sporting some new features that make them more flexible and easier to use. And all plotting functions now allow you to pass the data source first, making it easier to pipe a pandas dataframe into a seaborn plot.
Finally, the documentation has been revamped using the wonderful PyData sphinx theme. Not only does it look better, it should be more accessible and easier to navigate. And there is a new FAQ page with answers to common questions and explanations of notable gotchas.
How to upgrade
When you’re ready to upgrade, the new version is just a pip install away:
pip install seaborn==0.12.0
I hope you find it useful!