v0.3.0 (March 2014)#

This is a major release from 0.2 with a number of enhancements to the plotting capabilities and styles. Highlights include FacetGrid, factorplot, jointplot(), and an overhaul to style management. There is also lots of new documentation, including an example gallery and reorganized tutorial.

New plotting functions#

  • The FacetGrid class adds a new form of functionality to seaborn, providing a way to abstractly structure a grid of plots corresponding to subsets of a dataset. It can be used with a wide variety of plotting functions (including most of the matplotlib and seaborn APIs. See the tutorial for more information.

  • Version 0.3 introduces the factorplot function, which is similar in spirit to lmplot() but intended for use when the main independent variable is categorical instead of quantitative. factorplot can draw a plot in either a point or bar representation using the corresponding Axes-level functions pointplot() and barplot() (which are also new). Additionally, the factorplot function can be used to draw box plots on a faceted grid. For examples of how to use these functions, you can refer to the tutorial.

  • Another new function is jointplot(), which is built using the new JointGrid object. jointplot() generalizes the behavior of regplot() in previous versions of seaborn (regplot() has changed somewhat in 0.3; see below for details) by drawing a bivariate plot of the relationship between two variables with their marginal distributions drawn on the side of the plot. With jointplot(), you can draw a scatterplot or regression plot as before, but you can now also draw bivariate kernel densities or hexbin plots with appropriate univariate graphs for the marginal distributions. Additionally, it’s easy to use JointGrid directly to build up more complex plots when the default methods offered by jointplot() are not suitable for your visualization problem. The tutorial for JointGrid has more examples of how this object can be useful.

  • The residplot() function complements regplot() and can be quickly used to diagnose problems with a linear model by calculating and plotting the residuals of a simple regression. There is also a "resid" kind for jointplot().

API changes#

  • The most noticeable change will be that regplot() no longer produces a multi-component plot with distributions in marginal axes. Instead. regplot() is now an “Axes-level” function that can be plotted into any existing figure on a specific set of axes. regplot() and lmplot() have also been unified (the latter uses the former behind the scenes), so all options for how to fit and represent the regression model can be used for both functions. To get the old behavior of regplot(), use jointplot() with kind="reg".

  • As noted above, lmplot() has been rewritten to exploit the FacetGrid machinery. This involves a few changes. The color keyword argument has been replaced with hue, for better consistency across the package. The hue parameter will always take a variable name, while color will take a color name or (in some cases) a palette. The lmplot() function now returns the FacetGrid used to draw the plot instance.

  • The functions that interact with matplotlib rc parameters have been updated and standardized. There are now three pairs of functions, axes_style() and set_style(), plotting_context() and set_context(), and color_palette() and set_palette(). In each case, the pairs take the exact same arguments. The first function defines and returns the parameters, and the second sets the matplotlib defaults. Additionally, the first function in each pair can be used in a with statement to temporarily change the defaults. Both the style and context functions also now accept a dictionary of matplotlib rc parameters to override the seaborn defaults, and set() now also takes a dictionary to update any of the matplotlib defaults. See the tutorial for more information.

  • The nogrid style has been deprecated and changed to white for more uniformity (i.e. there are now darkgrid, dark, whitegrid, and white styles).

Other changes#

Using the package#

  • If you want to use plotting functions provided by the package without setting the matplotlib style to a seaborn theme, you can now do import seaborn.apionly as sns or from seaborn.apionly import lmplot, etc. This is using the (also new) reset_orig() function, which returns the rc parameters to what they are at matplotlib import time — i.e. they will respect any custom matplotlibrc settings on top of the matplotlib defaults.

  • The dependency load of the package has been reduced. It can now be installed and used with only numpy, scipy, matplotlib, and pandas. Although statsmodels is still recommended for full functionality, it is not required.

Plotting functions#

  • lmplot() (and regplot()) have two new options for fitting regression models: lowess and robust. The former fits a nonparametric smoother, while the latter fits a regression using methods that are less sensitive to outliers.

  • The regression uncertainty in lmplot() and regplot() is now estimated with fewer bootstrap iterations, so plotting should be faster.

  • The univariate kdeplot() can now be drawn as a cumulative density plot.

  • Changed interactplot() to use a robust calculation of the data range when finding default limits for the contour colormap to work better when there are outliers in the data.

Style#

  • There is a new style, dark, which shares most features with darkgrid but does not draw a grid by default.

  • There is a new function, offset_spines(), and a corresponding option in despine() called trim. Together, these can be used to make plots where the axis spines are offset from the main part of the figure and limited within the range of the ticks. This is recommended for use with the ticks style.

  • Other aspects of the seaborn styles have been tweaked for more attractive plots.