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 tolmplot()
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 functionspointplot()
andbarplot()
(which are also new). Additionally, thefactorplot
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 newJointGrid
object.jointplot()
generalizes the behavior ofregplot()
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. Withjointplot()
, 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 useJointGrid
directly to build up more complex plots when the default methods offered byjointplot()
are not suitable for your visualization problem. The tutorial forJointGrid
has more examples of how this object can be useful.The
residplot()
function complementsregplot()
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 forjointplot()
.
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()
andlmplot()
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 ofregplot()
, usejointplot()
withkind="reg"
.As noted above,
lmplot()
has been rewritten to exploit theFacetGrid
machinery. This involves a few changes. Thecolor
keyword argument has been replaced withhue
, for better consistency across the package. Thehue
parameter will always take a variable name, whilecolor
will take a color name or (in some cases) a palette. Thelmplot()
function now returns theFacetGrid
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()
andset_style()
,plotting_context()
andset_context()
, andcolor_palette()
andset_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 awith
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, andset()
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 towhite
for more uniformity (i.e. there are nowdarkgrid
,dark
,whitegrid
, andwhite
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
orfrom 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 custommatplotlibrc
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
, andpandas
. Althoughstatsmodels
is still recommended for full functionality, it is not required.
Plotting functions#
lmplot()
(andregplot()
) have two new options for fitting regression models:lowess
androbust
. 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()
andregplot()
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 withdarkgrid
but does not draw a grid by default.There is a new function,
offset_spines()
, and a corresponding option indespine()
calledtrim
. 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 theticks
style.Other aspects of the seaborn styles have been tweaked for more attractive plots.