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
jointplot(), and an overhaul to style management. There is also lots of new documentation, including an example gallery and reorganized tutorial.
New plotting functions#
FacetGridclass 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
factorplotfunction, which is similar in spirit to
lmplot()but intended for use when the main independent variable is categorical instead of quantitative.
factorplotcan draw a plot in either a point or bar representation using the corresponding Axes-level functions
barplot()(which are also new). Additionally, the
factorplotfunction 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
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
JointGriddirectly to build up more complex plots when the default methods offered by
jointplot()are not suitable for your visualization problem. The tutorial for
JointGridhas more examples of how this object can be useful.
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
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.
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
As noted above,
lmplot()has been rewritten to exploit the
FacetGridmachinery. This involves a few changes. The
colorkeyword argument has been replaced with
hue, for better consistency across the package. The
hueparameter will always take a variable name, while
colorwill take a color name or (in some cases) a palette. The
lmplot()function now returns the
FacetGridused 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,
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
withstatement 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.
nogridstyle has been deprecated and changed to
whitefor more uniformity (i.e. there are now
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 snsor
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
matplotlibrcsettings on top of the matplotlib defaults.
The dependency load of the package has been reduced. It can now be installed and used with only
statsmodelsis still recommended for full functionality, it is not required.
regplot()) have two new options for fitting regression models:
robust. The former fits a nonparametric smoother, while the latter fits a regression using methods that are less sensitive to outliers.
kdeplot()can now be drawn as a cumulative density plot.
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.
There is a new style,
dark, which shares most features with
darkgridbut does not draw a grid by default.
There is a new function,
offset_spines(), and a corresponding option in
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
Other aspects of the seaborn styles have been tweaked for more attractive plots.