What’s new in each version¶
This page contains information about what has changed in each new version of seaborn
.
v0.11.2 (August 2021)¶
This is a minor release that addresses issues in the v0.11 series and adds a small number of targeted enhancements. It is a recommended upgrade for all users.
Docs A paper describing seaborn has been published in the Journal of Open Source Software. The paper serves as an introduction to the library and can be used to cite seaborn if it has been integral to a scientific publication.
API Feature In
lmplot()
, added a newfacet_kws
parameter and deprecated thesharex
,sharey
, andlegend_out
parameters from the function signature; pass them in afacet_kws
dictionary instead (#2576).Feature Added a
move_legend()
convenience function for repositioning the legend on an existing axes or figure, along with updating its properties. This function should be preferred over callingax.legend
with no legend data, which does not reliably work across seaborn plot types (#2643).Feature In
histplot()
, addedstat="percent"
as an option for normalization such that bar heights sum to 100 andstat="proportion"
as an alias for the existingstat="probability"
(#2461, #2634).Feature Added
FacetGrid.refline()
andJointGrid.refline()
methods for plotting horizontal and/or vertical reference lines on every subplot in one step (#2620).Feature In
kdeplot()
, added awarn_singular
parameter to silence the warning about data with zero variance (#2566).Enhancement In
histplot()
, improved performance with large datasets and many groupings/facets (#2559, #2570).Enhancement The
FacetGrid
,PairGrid
, andJointGrid
objects now reference the underlying matplotlib figure with a.figure
attribute. The existing.fig
attribute still exists but is discouraged and may eventually be deprecated. The effect is that you can now callobj.figure
on the return value from any seaborn function to access the matplotlib object (#2639).Enhancement In
FacetGrid
and functions that use it, visibility of the interior axis labels is now disabled, and exterior axis labels are no longer erased when adding additional layers. This produces the same results for plots made by seaborn functions, but it may produce different (better, in most cases) results for customized facet plots (#2583).Enhancement In
FacetGrid
,PairGrid
, and functions that use them, the matplotlibfigure.autolayout
parameter is disabled to avoid having the legend overlap the plot (#2571).Enhancement The
load_dataset()
helper now produces a more informative error when fed a dataframe, easing a common beginner mistake (#2604).Fix Enhancement Improved robustness to missing data, including some additional support for the
pd.NA
type (#2417, #2435).Fix In
ecdfplot()
andrugplot()
, fixed a bug where results were incorrect if the data axis had a log scale before plotting (#2504).Fix In
histplot()
, fixed a bug where usingshrink
with non-discrete bins shifted bar positions inaccurately (#2477).Fix In
displot()
, fixed a bug wherecommon_norm=False
was ignored when faceting was used without assigninghue
(#2468).Fix In
histplot()
, fixed two bugs where automatically computed edge widths were too thick for log-scaled histograms and for categorical histograms on the y axis (#2522).Fix In
histplot()
andkdeplot()
, fixed a bug where thealpha
parameter was ignored whenfill=False
(#2460).Fix In
histplot()
andkdeplot()
, fixed a bug where themultiple
parameter was ignored whenhue
was provided as a vector without a name (#2462).Fix In
displot()
, the default alpha value now adjusts to a providedmultiple
parameter even whenhue
is not assigned (#2462).Fix In
displot()
, fixed a bug that caused faceted 2D histograms to error out withcommon_bins=False
(#2640).Fix In
rugplot()
, fixed a bug that prevented the use of datetime data (#2458).Fix In
relplot()
anddisplot()
, fixed a bug where the dataframe attached to the returnedFacetGrid
object dropped columns that were not used in the plot (#2623).Fix In
relplot()
, fixed an error that would be raised when one of the column names in the dataframe shared a name with one of the plot variables (#2581).Fix In the relational plots, fixed a bug where legend entries for the
size
semantic were incorrect whensize_norm
extrapolated beyond the range of the data (#2580).Fix In
lmplot()
andregplot()
, fixed a bug where the x axis was clamped to the data limits withtruncate=True
(#2576).Fix In
lmplot()
, fixed a bug wheresharey=False
did not always work as expected (#2576).Fix In
heatmap()
, fixed a bug where vertically-rotated y-axis tick labels would be misaligned with their rows (#2574).Fix Fixed an issue that prevented Python from running in
-OO
mode while using seaborn (#2473).Docs Improved the API documentation for theme-related functions (#2573).
Docs Added docstring pages for all methods on documented classes (#2644).
v0.11.1 (December 2020)¶
This a bug fix release and is a recommended upgrade for all users on v0.11.0.
Enhancement Reduced the use of matplotlib global state in the multi-grid classes (#2388).
Fix Restored support for using tuples or numeric keys to reference fields in a long-form
data
object (#2386).Fix Fixed a bug in
lineplot()
where NAs were propagating into the confidence interval, sometimes erasing it from the plot (#2273).Fix Fixed a bug in
PairGrid
/pairplot()
where diagonal axes would be empty when the grid was not square and the diagonal axes did not contain the marginal plots (#2270).Fix Fixed a bug in
PairGrid
/pairplot()
where off-diagonal plots would not appear when column names indata
had non-string type (#2368).Fix Fixed a bug where categorical dtype information was ignored when data consisted of boolean or boolean-like values (#2379).
Fix Fixed a bug in
FacetGrid
where interior tick labels would be hidden when only the orthogonal axis was shared (#2347).Fix Fixed a bug in
FacetGrid
that caused an error whenlegend_out=False
was set (#2304).Fix Fixed a bug in
kdeplot()
wherecommon_norm=True
was ignored ifhue
was not assigned (#2378).Fix Fixed a bug in
displot()
where therow_order
andcol_order
parameters were not used (#2262).Fix Fixed a bug in
PairGrid
/pairplot()
that caused an exception when usingcorner=True
anddiag_kind=None
(#2382).Fix Fixed a bug in
clustermap()
whereannot=False
was ignored (#2323).Fix Fixed a bug in
clustermap()
where row/col color annotations could not have a categorical dtype (#2389).Fix Fixed a bug in
boxenplot()
where thelinewidth
parameter was ignored (#2287).Fix Raise a more informative error in
PairGrid
/pairplot()
when no variables can be found to define the rows/columns of the grid (#2382).Fix Raise a more informative error from
clustermap()
if row/col color objects have semantic index but data object does not (#2313).
v0.11.0 (September 2020)¶
This is a major release with several important new features, enhancements to existing functions, and changes to the library. Highlights include an overhaul and modernization of the distributions plotting functions, more flexible data specification, new colormaps, and better narrative documentation.
For an overview of the new features and a guide to updating, see this Medium post.
Required keyword arguments¶
API
Most plotting functions now require all of their parameters to be specified using keyword arguments. To ease adaptation, code without keyword arguments will trigger a FutureWarning
in v0.11. In a future release (v0.12 or v0.13, depending on release cadence), this will become an error. Once keyword arguments are fully enforced, the signature of the plotting functions will be reorganized to accept data
as the first and only positional argument (#2052, #2081).
Modernization of distribution functions¶
The distribution module has been completely overhauled, modernizing the API and introducing several new functions and features within existing functions. Some new features are explained here; the tutorial documentation has also been rewritten and serves as a good introduction to the functions.
New plotting functions¶
Feature Enhancement
First, three new functions, displot()
, histplot()
and ecdfplot()
have been added (#2157, #2125, #2141).
The figure-level displot()
function is an interface to the various distribution plots (analogous to relplot()
or catplot()
). It can draw univariate or bivariate histograms, density curves, ECDFs, and rug plots on a FacetGrid
.
The axes-level histplot()
function draws univariate or bivariate histograms with a number of features, including:
mapping multiple distributions with a
hue
semanticnormalization to show density, probability, or frequency statistics
flexible parameterization of bin size, including proper bins for discrete variables
adding a KDE fit to show a smoothed distribution over all bin statistics
experimental support for histograms over categorical and datetime variables.
The axes-level ecdfplot()
function draws univariate empirical cumulative distribution functions, using a similar interface.
Changes to existing functions¶
API Feature Enhancement Defaults
Second, the existing functions kdeplot()
and rugplot()
have been completely overhauled (#2060, #2104).
The overhauled functions now share a common API with the rest of seaborn, they can show conditional distributions by mapping a third variable with a hue
semantic, and they have been improved in numerous other ways. The github pull request (#2104) has a longer explanation of the changes and the motivation behind them.
This is a necessarily API-breaking change. The parameter names for the positional variables are now x
and y
, and the old names have been deprecated. Efforts were made to handle and warn when using the deprecated API, but it is strongly suggested to check your plots carefully.
Additionally, the statsmodels-based computation of the KDE has been removed. Because there were some inconsistencies between the way different parameters (specifically, bw
, clip
, and cut
) were implemented by each backend, this may cause plots to look different with non-default parameters. Support for using non-Gaussian kernels, which was available only in the statsmodels backend, has been removed.
Other new features include:
several options for representing multiple densities (using the
multiple
andcommon_norm
parameters)weighted density estimation (using the new
weights
parameter)better control over the smoothing bandwidth (using the new
bw_adjust
parameter)more meaningful parameterization of the contours that represent a bivariate density (using the
thresh
andlevels
parameters)log-space density estimation (using the new
log_scale
parameter, or by scaling the data axis before plotting)“bivariate” rug plots with a single function call (by assigning both
x
andy
)
Deprecations¶
API
Finally, the distplot()
function is now formally deprecated. Its features have been subsumed by displot()
and histplot()
. Some effort was made to gradually transition distplot()
by adding the features in displot()
and handling backwards compatibility, but this proved to be too difficult. The similarity in the names will likely cause some confusion during the transition, which is regrettable.
Standardization and enhancements of data ingest¶
Feature Enhancement Docs
The code that processes input data has been refactored and enhanced. In v0.11, this new code takes effect for the relational and distribution modules; other modules will be refactored to use it in future releases (#2071).
These changes should be transparent for most use-cases, although they allow a few new features:
Named variables for long-form data can refer to the named index of a
pandas.DataFrame
or to levels in the case of a multi-index. Previously, it was necessary to callpandas.DataFrame.reset_index()
before using index variables (e.g., after a groupby operation).relplot()
now has the same flexibility as the axes-level functions to accept data in long- or wide-format and to accept data vectors (rather than named variables) in long-form mode.The data parameter can now be a Python
dict
or an object that implements that interface. This is a new feature for wide-form data. For long-form data, it was previously supported but not documented.A wide-form data object can have a mixture of types; the non-numeric types will be removed before plotting. Previously, this caused an error.
There are better error messages for other instances of data mis-specification.
See the new user guide chapter on data formats for more information about what is supported.
Other changes¶
Documentation improvements¶
Docs Added two new chapters to the user guide, one giving an overview of the types of functions in seaborn, and one discussing the different data formats that seaborn understands.
Docs Expanded the color palette tutorial to give more background on color theory and better motivate the use of color in statistical graphics.
Docs Added more information to the installation guidelines and streamlined the introduction page.
Docs Improved cross-linking within the seaborn docs and between the seaborn and matplotlib docs.
Theming¶
API The
set()
function has been renamed toset_theme()
for more clarity about what it does. For the foreseeable future,set()
will remain as an alias, but it is recommended to update your code.
Relational plots¶
Enhancement Defaults Reduced some of the surprising behavior of relational plot legends when using a numeric hue or size mapping (#2229):
Added an “auto” mode (the new default) that chooses between “brief” and “full” legends based on the number of unique levels of each variable.
Modified the ticking algorithm for a “brief” legend to show up to 6 values and not to show values outside the limits of the data.
Changed the approach to the legend title: the normal matplotlib legend title is used when only one variable is assigned a semantic mapping, whereas the old approach of adding an invisible legend artist with a subtitle label is used only when multiple semantic variables are defined.
Modified legend subtitles to be left-aligned and to be drawn in the default legend title font size.
Enhancement Defaults Changed how functions that use different representations for numeric and categorical data handle vectors with an
object
data type. Previously, data was considered numeric if it could be coerced to a float representation without error. Now, object-typed vectors are considered numeric only when their contents are themselves numeric. As a consequence, numbers that are encoded as strings will now be treated as categorical data (#2084).Enhancement Defaults Plots with a
style
semantic can now generate an infinite number of unique dashes and/or markers by default. Previously, an error would be raised if thestyle
variable had more levels than could be mapped using the default lists. The existing defaults were slightly modified as part of this change; if you need to exactly reproduce plots from earlier versions, refer to the old defaults (#2075).Defaults Changed how
scatterplot()
sets the default linewidth for the edges of the scatter points. New behavior is to scale with the point sizes themselves (on a plot-wise, not point-wise basis). This change also slightly reduces the default width when point sizes are not varied. Setlinewidth=0.75
to reproduce the previous behavior. (#2708).Enhancement Improved support for datetime variables in
scatterplot()
andlineplot()
(#2138).Fix Fixed a bug where
lineplot()
did not pass thelinestyle
parameter down to matplotlib (#2095).Fix Adapted to a change in matplotlib that prevented passing vectors of literal values to
c
ands
inscatterplot()
(#2079).
Categorical plots¶
Enhancement Defaults Fix Fixed a few computational issues in
boxenplot()
and improved its visual appearance (#2086):Changed the default method for computing the number of boxes to``k_depth=”tukey”
, as the previous default (``k_depth="proportion"
) is based on a heuristic that produces too many boxes for small datasets.Added the option to specify the specific number of boxes (e.g.
k_depth=6
) or to plot boxes that will cover most of the data points (k_depth="full"
).Added a new parameter,
trust_alpha
, to control the number of boxes whenk_depth="trustworthy"
.Changed the visual appearance of
boxenplot()
to more closely resembleboxplot()
. Notably, thin boxes will remain visible when the edges are white.
Enhancement Allowed
catplot()
to use different values on the categorical axis of each facet when axis sharing is turned off (e.g. by specifyingsharex=False
) (#2196).Enhancement Improved the error messages produced when categorical plots process the orientation parameter.
Enhancement Added an explicit warning in
swarmplot()
when more than 5% of the points overlap in the “gutters” of the swarm (#2045).
Multi-plot grids¶
Feature Enhancement Defaults A few small changes to make life easier when using
PairGrid
(#2234):Added public access to the legend object through the
legend
attribute (also affectsFacetGrid
).The
color
andlabel
parameters are no longer passed to the plotting functions whenhue
is not used.The data is no longer converted to a numpy object before plotting on the marginal axes.
It is possible to specify only one of
x_vars
ory_vars
, using all variables for the unspecified dimension.The
layout_pad
parameter is stored and used every time you call thePairGrid.tight_layout()
method.
Feature Added a
tight_layout
method toFacetGrid
andPairGrid
, which runs thematplotlib.pyplot.tight_layout()
algorithm without interference from the external legend (#2073).Feature Added the
axes_dict
attribute toFacetGrid
for named access to the component axes (#2046).Enhancement Made
FacetGrid.set_axis_labels()
clear labels from “interior” axes (#2046).Feature Added the
marginal_ticks
parameter toJointGrid
which, if set toTrue
, will show ticks on the count/density axis of the marginal plots (#2210).Enhancement Improved
FacetGrid.set_titles()
withmargin_titles=True
, such that texts representing the original row titles are removed before adding new ones (#2083).Defaults Changed the default value for
dropna
toFalse
inFacetGrid
,PairGrid
,JointGrid
, and corresponding functions. As all or nearly all seaborn and matplotlib plotting functions handle missing data well, this option is no longer useful, but it causes problems in some edge cases. It may be deprecated in the future. (#2204).Fix Fixed a bug in
PairGrid
that appeared when settingcorner=True
anddespine=False
(#2203).
Color palettes¶
Docs Improved and modernized the color palettes chapter of the seaborn tutorial.
Feature Added two new perceptually-uniform colormaps: “flare” and “crest”. The new colormaps are similar to “rocket” and “mako”, but their luminance range is reduced. This makes them well suited to numeric mappings of line or scatter plots, which need contrast with the axes background at the extremes (#2237).
Enhancement Defaults Enhanced numeric colormap functionality in several ways (#2237):
Added string-based access within the
color_palette()
interface todark_palette()
,light_palette()
, andblend_palette()
. This means that anywhere you specify a palette in seaborn, a name like"dark:blue"
will usedark_palette()
with the input"blue"
.Added the
as_cmap
parameter tocolor_palette()
and changed internal code that uses a continuous colormap to take this route.Tweaked the
light_palette()
anddark_palette()
functions to use an endpoint that is a very desaturated version of the input color, rather than a pure gray. This produces smoother ramps. To exactly reproduce previous plots, useblend_palette()
with".13"
for dark or".95"
for light.Changed
diverging_palette()
to have a default value ofsep=1
, which gives better results.
Enhancement Added a rich HTML representation to the object returned by
color_palette()
(#2225).Fix Fixed the
"{palette}_d"
logic to modify reversed colormaps and to use the correct direction of the luminance ramp in both cases.
Deprecations and removals¶
Enhancement Removed an optional (and undocumented) dependency on BeautifulSoup (#2190) in
get_dataset_names()
.API Deprecated the
axlabel
function; useax.set(xlabel=, ylabel=)
instead.API Deprecated the
iqr
function; usescipy.stats.iqr()
instead.API Final removal of the previously-deprecated
annotate
method onJointGrid
, along with related parameters.API Final removal of the
lvplot
function (the previously-deprecated name forboxenplot()
).
v0.10.1 (April 2020)¶
This is minor release with bug fixes for issues identified since 0.10.0.
Fixed a bug that appeared within the bootstrapping algorithm on 32-bit systems.
Fixed a bug where
regplot()
would crash on singleton inputs. Now a crash is avoided and regression estimation/plotting is skipped.Fixed a bug where
heatmap()
would ignore user-specified under/over/bad values when recentering a colormap.Fixed a bug where
heatmap()
would use values from masked cells when computing default colormap limits.Fixed a bug where
despine()
would cause an error when trying to trim spines on a matplotlib categorical axis.Adapted to a change in matplotlib that caused problems with single swarm plots.
Added the
showfliers
parameter toboxenplot()
to suppress plotting of outlier data points, matching the API ofboxplot()
.Avoided seeing an error from statmodels when data with an IQR of 0 is passed to
kdeplot()
.Added the
legend.title_fontsize
to theplotting_context()
definition.Deprecated several utility functions that are no longer used internally (
percentiles
,sig_stars
,pmf_hist
, andsort_df
).
v0.10.0 (January 2020)¶
This is a major update that is being released simultaneously with version 0.9.1. It has all of the same features (and bugs!) as 0.9.1, but there are important changes to the dependencies.
Most notably, all support for Python 2 has now been dropped. Support for Python 3.5 has also been dropped. Seaborn is now strictly compatible with Python 3.6+.
Minimally supported versions of the dependent PyData libraries have also been increased, in some cases substantially. While seaborn has tended to be very conservative about maintaining compatibility with older dependencies, this was causing increasing pain during development. At the same time, these libraries are now much easier to install. Going forward, seaborn will likely stay close to the Numpy community guidelines for version support.
This release also removes a few previously-deprecated features:
The
tsplot
function andseaborn.timeseries
module have been removed. Recall thattsplot
was replaced withlineplot()
.The
seaborn.apionly
entry-point has been removed.The
seaborn.linearmodels
module (previously renamed toseaborn.regression
) has been removed.
Looking forward¶
Now that seaborn is a Python 3 library, it can take advantage of keyword-only arguments. It is likely that future versions will introduce this syntax, potentially in a breaking way. For guidance, most seaborn functions have a signature that looks like
func(x, y, ..., data=None, **kwargs)
where the **kwargs
are specified in the function. Going forward it will likely be necessary to specify data
and all subsequent arguments with an explicit key=value
mapping. This style has long been used throughout the documentation, and the formal requirement will not be introduced until at least the next major release. Adding this feature will make it possible to enhance some older functions with more modern capabilities (e.g., adding a native hue
semantic within functions like jointplot()
and regplot()
) and will allow parameters that control new features to be situated nearby related, making them more discoverable.
v0.9.1 (January 2020)¶
This is a minor release with a number of bug fixes and adaptations to changes in seaborn’s dependencies. There are also several new features.
This is the final version of seaborn that will support Python 2.7 or 3.5.
New features¶
Added more control over the arrangement of the elements drawn by
clustermap()
with the{dendrogram,colors}_ratio
andcbar_pos
parameters. Additionally, the default organization and scaling with different figure sizes has been improved.Added the
corner
option toPairGrid
andpairplot()
to make a grid without the upper triangle of bivariate axes.Added the ability to seed the random number generator for the bootstrap used to define error bars in several plots. Relevant functions now have a
seed
parameter, which can take either fixed seed (typically anint
) or a numpy random number generator object (either the newernumpy.random.Generator
or the oldernumpy.random.mtrand.RandomState
).Generalized the idea of “diagonal” axes in
PairGrid
to any axes that share an x and y variable.In
PairGrid
, thehue
variable is now excluded from the default list of variables that make up the rows and columns of the grid.Exposed the
layout_pad
parameter inPairGrid
and set a smaller default than what matptlotlib sets for more efficient use of space in dense grids.It is now possible to force a categorical interpretation of the
hue
variable in a relational plot by passing the name of a categorical palette (e.g."deep"
, or"Set2"
). This complements the (previously supported) option of passing a list/dict of colors.Added the
tree_kws
parameter toclustermap()
to control the properties of the lines in the dendrogram.Added the ability to pass hierarchical label names to the
FacetGrid
legend, which also fixes a bug inrelplot()
when the same label appeared in different semantics.Improved support for grouping observations based on pandas index information in categorical plots.
Bug fixes and adaptations¶
Avoided an error when singular data is passed to
kdeplot()
, issuing a warning instead. This makespairplot()
more robust.Fixed the behavior of
dropna
inPairGrid
to properly exclude null datapoints from each plot when set toTrue
.Fixed an issue where
regplot()
could interfere with other axes in a multi-plot matplotlib figure.Semantic variables with a
category
data type will always be treated as categorical in relational plots.Avoided a warning about color specifications that arose from
boxenplot()
on newer matplotlibs.Adapted to a change in how matplotlib scales axis margins, which caused multiple calls to
regplot()
withtruncate=False
to progressively expand the x axis limits. Because there are currently limitations on how autoscaling works in matplotlib, the default value fortruncate
in seaborn has also been changed toTrue
.Relational plots no longer error when hue/size data are inferred to be numeric but stored with a string datatype.
Relational plots now consider semantics with only a single value that can be interpreted as boolean (0 or 1) to be categorical, not numeric.
Relational plots now handle list or dict specifications for
sizes
correctly.Fixed an issue in
pointplot()
where missing levels of a hue variable would cause an exception after a recent update in matplotlib.Fixed a bug when setting the rotation of x tick labels on a
FacetGrid
.Fixed a bug where values would be excluded from categorical plots when only one variable was a pandas
Series
with a non-default index.Fixed a bug when using
Series
objects as arguments forx_partial
ory_partial
inregplot()
.Fixed a bug when passing a
norm
object and using color annotations inclustermap()
.Fixed a bug where annotations were not rearranged to match the clustering in
clustermap()
.Fixed a bug when trying to call
set()
while specifying a list of colors for the palette.Fixed a bug when resetting the color code short-hands to the matplotlib default.
Avoided errors from stricter type checking in upcoming
numpy
changes.Avoided error/warning in
lineplot()
when plotting categoricals with empty levels.Allowed
colors
to be passed through to a bivariatekdeplot()
.Standardized the output format of custom color palette functions.
Fixed a bug where legends for numerical variables in a relational plot could show a surprisingly large number of decimal places.
Improved robustness to missing values in distribution plots.
Made it possible to specify the location of the
FacetGrid
legend using matplotlib keyword arguments.
v0.9.0 (July 2018)¶
This is a major release with several substantial and long-desired new features. There are also updates/modifications to the themes and color palettes that give better consistency with matplotlib 2.0 and some notable API changes.
New relational plots¶
Three completely new plotting functions have been added: relplot()
, scatterplot()
, and lineplot()
. The first is a figure-level interface to the latter two that combines them with a FacetGrid
. The functions bring the high-level, dataset-oriented API of the seaborn categorical plotting functions to more general plots (scatter plots and line plots).
These functions can visualize a relationship between two numeric variables while mapping up to three additional variables by modifying hue
, size
, and/or style
semantics. The common high-level API is implemented differently in the two functions. For example, the size semantic in scatterplot()
scales the area of scatter plot points, but in lineplot()
it scales width of the line plot lines. The API is dataset-oriented, meaning that in both cases you pass the variable in your dataset rather than directly specifying the matplotlib parameters to use for point area or line width.
Another way the relational functions differ from existing seaborn functionality is that they have better support for using numeric variables for hue
and size
semantics. This functionality may be propagated to other functions that can add a hue
semantic in future versions; it has not been in this release.
The lineplot()
function also has support for statistical estimation and is replacing the older tsplot
function, which still exists but is marked for removal in a future release. lineplot()
is better aligned with the API of the rest of the library and more flexible in showing relationships across additional variables by modifying the size and style semantics independently. It also has substantially improved support for date and time data, a major pain factor in tsplot
. The cost is that some of the more esoteric options in tsplot
for representing uncertainty (e.g. a colormapped KDE of the bootstrap distribution) have not been implemented in the new function.
There is quite a bit of new documentation that explains these new functions in more detail, including detailed examples of the various options in the API reference and a more verbose tutorial.
These functions should be considered in a “stable beta” state. They have been thoroughly tested, but some unknown corner cases may remain to be found. The main features are in place, but not all planned functionality has been implemented. There are planned improvements to some elements, particularly the default legend, that are a little rough around the edges in this release. Finally, some of the default behavior (e.g. the default range of point/line sizes) may change somewhat in future releases.
Updates to themes and palettes¶
Several changes have been made to the seaborn style themes, context scaling, and color palettes. In general the aim of these changes was to make the seaborn styles more consistent with the style updates in matplotlib 2.0 and to leverage some of the new style parameters for better implementation of some aspects of the seaborn styles. Here is a list of the changes:
Reorganized and updated some
axes_style()
/plotting_context()
parameters to take advantage of improvements in the matplotlib 2.0 update. The biggest change involves using several new parameters in the “style” spec while moving parameters that used to implement the corresponding aesthetics to the “context” spec. For example, axes spines and ticks are now off instead of having their width/length zeroed out for the darkgrid style. That means the width/length of these elements can now be scaled in different contexts. The effect is a more cohesive appearance of the plots, especially in larger contexts. These changes include only minimal support for the 1.x matplotlib series. Users who are stuck on matplotlib 1.5 but wish to use seaborn styling may want to use the seaborn parameters that can be accessed through the matplotlib stylesheet interface.Updated the seaborn palettes (“deep”, “muted”, “colorblind”, etc.) to correspond with the new 10-color matplotlib default. The legacy palettes are now available at “deep6”, “muted6”, “colorblind6”, etc. Additionally, a few individual colors were tweaked for better consistency, aesthetics, and accessibility.
Calling
color_palette()
(orset_palette()
) with a named qualitative palettes (i.e. one of the seaborn palettes, the colorbrewer qualitative palettes, or the matplotlib matplotlib tableau-derived palettes) and no specified number of colors will return all of the colors in the palette. This means that for some palettes, the returned list will have a different length than it did in previous versions.Enhanced
color_palette()
to accept a parameterized specification of a cubehelix palette in in a string, prefixed with"ch:"
(e.g."ch:-.1,.2,l=.7"
). Note that keyword arguments can be spelled out or referenced using only their first letter. Reversing the palette is accomplished by appending"_r"
, as with other matplotlib colormaps. This specification will be accepted by any seaborn function with apalette=
parameter.Slightly increased the base font sizes in
plotting_context()
and increased the scaling factors for"talk"
and"poster"
contexts.Calling
set()
will now callset_color_codes()
to re-assign the single letter color codes by default
API changes¶
A few functions have been renamed or have had changes to their default parameters.
The
factorplot
function has been renamed tocatplot()
. The new name ditches the original R-inflected terminology to use a name that is more consistent with terminology in pandas and in seaborn itself. This change should hopefully makecatplot()
easier to discover, and it should make more clear what its role is.factorplot
still exists and will pass its arguments through tocatplot()
with a warning. It may be removed eventually, but the transition will be as gradual as possible.The other reason that the
factorplot
name was changed was to ease another alteration which is that the defaultkind
incatplot()
is now"strip"
(corresponding tostripplot()
). This plots a categorical scatter plot which is usually a much better place to start and is more consistent with the default inrelplot()
. The old default style infactorplot
("point"
, corresponding topointplot()
) remains available if you want to show a statistical estimation.The
lvplot
function has been renamed toboxenplot()
. The “letter-value” terminology that was used to name the original kind of plot is obscure, and the abbreviation tolv
did not help anything. The new name should make the plot more discoverable by describing its format (it plots multiple boxes, also known as “boxen”). As withfactorplot
, thelvplot
function still exists to provide a relatively smooth transition.Renamed the
size
parameter toheight
in multi-plot grid objects (FacetGrid
,PairGrid
, andJointGrid
) along with functions that use them (factorplot
,lmplot()
,pairplot()
, andjointplot()
) to avoid conflicts with thesize
parameter that is used inscatterplot
andlineplot
(necessary to makerelplot()
work) and also makes the meaning of the parameter a bit more clear.Changed the default diagonal plots in
pairplot()
to use func:kdeplot
when a"hue"
dimension is used.Deprecated the statistical annotation component of
JointGrid
. The method is still available but will be removed in a future version.Two older functions that were deprecated in earlier versions,
coefplot
andinteractplot
, have undergone final removal from the code base.
Documentation improvements¶
There has been some effort put into improving the documentation. The biggest change is that the introduction to the library has been completely rewritten to provide much more information and, critically, examples. In addition to the high-level motivation, the introduction also covers some important topics that are often sources of confusion, like the distinction between figure-level and axes-level functions, how datasets should be formatted for use in seaborn, and how to customize the appearance of the plots.
Other improvements have been made throughout, most notably a thorough re-write of the categorical tutorial.
Other small enhancements and bug fixes¶
Changed
rugplot()
to plot a matplotlibLineCollection
instead of manyLine2D
objects, providing a big speedup for large arrays.Changed the default off-diagonal plots to use
scatterplot()
. (Note that the"hue"
currently draws three separate scatterplots instead of using the hue semantic of the scatterplot function).Changed color handling when using
kdeplot()
with two variables. The default colormap for the 2D density now follows the color cycle, and the function can usecolor
andlabel
kwargs, adding more flexibility and avoiding a warning when using with multi-plot grids.Added the
subplot_kws
parameter toPairGrid
for more flexibility.Removed a special case in
PairGrid
that defaulted to drawing stacked histograms on the diagonal axes.Fixed
jointplot()
/JointGrid
andregplot()
so that they now accept list inputs.Fixed a bug in
FacetGrid
when using a single row/column level or usingcol_wrap=1
.Fixed functions that set axis limits so that they preserve auto-scaling state on matplotlib 2.0.
Avoided an error when using matplotlib backends that cannot render a canvas (e.g. PDF).
Changed the install infrastructure to explicitly declare dependencies in a way that
pip
is aware of. This means thatpip install seaborn
will now work in an empty environment. Additionally, the dependencies are specified with strict minimal versions.Updated the testing infrastructure to execute tests with pytest (although many individual tests still use nose assertion).
v0.8.1 (September 2017)¶
Added a warning in
FacetGrid
when passing a categorical plot function without specifyingorder
(orhue_order
whenhue
is used), which is likely to produce a plot that is incorrect.Improved compatibility between
FacetGrid
orPairGrid
and interactive matplotlib backends so that the legend no longer remains inside the figure when usinglegend_out=True
.Changed categorical plot functions with small plot elements to use
dark_palette()
instead oflight_palette()
when generating a sequential palette from a specified color.Improved robustness of
kdeplot()
anddistplot()
to data with fewer than two observations.Fixed a bug in
clustermap()
when usingyticklabels=False
.Fixed a bug in
pointplot()
where colors were wrong if exactly three points were being drawn.Fixed a bug in
pointplot()
where legend entries for missing data appeared with empty markers.Fixed a bug in
clustermap()
where an error was raised when annotating the main heatmap and showing category colors.Fixed a bug in
clustermap()
where row labels were not being properly rotated when they overlapped.Fixed a bug in
kdeplot()
where the maximum limit on the density axes was not being updated when multiple densities were drawn.Improved compatibility with future versions of pandas.
v0.8.0 (July 2017)¶
The default style is no longer applied when seaborn is imported. It is now necessary to explicitly call
set()
or one or more ofset_style()
,set_context()
, andset_palette()
. Correspondingly, theseaborn.apionly
module has been deprecated.Changed the behavior of
heatmap()
(and by extensionclustermap()
) when plotting divergent dataesets (i.e. when thecenter
parameter is used). Instead of extending the lower and upper limits of the colormap to be symmetrical around thecenter
value, the colormap is modified so that its middle color corresponds tocenter
. This means that the full range of the colormap will not be used (unless the data or specifiedvmin
andvmax
are symmetric), but the upper and lower limits of the colorbar will correspond to the range of the data. See the Github pull request (#1184) for examples of the behavior.Removed automatic detection of diverging data in
heatmap()
(and by extensionclustermap()
). If you want the colormap to be treated as diverging (see above), it is now necessary to specify thecenter
value. When no colormap is specified, specifyingcenter
will still change the default to be one that is more appropriate for displaying diverging data.Added four new colormaps, created using viscm for perceptual uniformity. The new colormaps include two sequential colormaps (“rocket” and “mako”) and two diverging colormaps (“icefire” and “vlag”). These colormaps are registered with matplotlib on seaborn import and the colormap objects can be accessed in the
seaborn.cm
namespace.Changed the default
heatmap()
colormaps to be “rocket” (in the case of sequential data) or “icefire” (in the case of diverging data). Note that this change reverses the direction of the luminance ramp from the previous defaults. While potentially confusing and disruptive, this change better aligns the seaborn defaults with the new matplotlib default colormap (“viridis”) and arguably better aligns the semantics of a “heat” map with the appearance of the colormap.Added
"auto"
as a (default) option for tick labels inheatmap()
andclustermap()
. This will try to estimate how many ticks can be labeled without the text objects overlapping, which should improve performance for larger matrices.Added the
dodge
parameter toboxplot()
,violinplot()
, andbarplot()
to allow use ofhue
without changing the position or width of the plot elements, as when thehue
varible is not nested within the main categorical variable.Correspondingly, the
split
parameter forstripplot()
andswarmplot()
has been renamed tododge
for consistency with the other categorical functions (and for differentiation from the meaning ofsplit
inviolinplot()
).Added the ability to draw a colorbar for a bivariate
kdeplot()
with thecbar
parameter (and relatedcbar_ax
andcbar_kws
parameters).Added the ability to use error bars to show standard deviations rather than bootstrap confidence intervals in most statistical functions by putting
ci="sd"
.Allow side-specific offsets in
despine()
.Figure size is no longer part of the seaborn plotting context parameters.
Put a cap on the number of bins used in
jointplot()
fortype=="hex"
to avoid hanging when the reference rule prescribes too many.Changed the y axis in
heatmap()
. Instead of reversing the rows of the data internally, the y axis is now inverted. This may affect code that draws on top of the heatmap in data coordinates.Turn off dendrogram axes in
clustermap()
rather than setting the background color to white.New matplotlib qualitative palettes (e.g. “tab10”) are now handled correctly.
Some modules and functions have been internally reorganized; there should be no effect on code that uses the
seaborn
namespace.Added a deprecation warning to
tsplot
function to indicate that it will be removed or replaced with a substantially altered version in a future release.The
interactplot
andcoefplot
functions are officially deprecated and will be removed in a future release.
v0.7.1 (June 2016)¶
Added the ability to put “caps” on the error bars that are drawn by
barplot()
orpointplot()
(and, by extension,factorplot
). Additionally, the line width of the error bars can now be controlled. These changes involve the new parameterscapsize
anderrwidth
. See the github pull request (#898) for examples of usage.Improved the row and column colors display in
clustermap()
. It is now possible to pass Pandas objects for these elements and, when possible, the semantic information in the Pandas objects will be used to add labels to the plot. When Pandas objects are used, the color data is matched against the main heatmap based on the index, not on position. This is more accurate, but it may lead to different results if current code assumed positional matching.Improved the luminance calculation that determines the annotation color in
heatmap()
.The
annot
parameter ofheatmap()
now accepts a rectangular dataset in addition to a boolean value. If a dataset is passed, its values will be used for the annotations, while the main dataset will be used for the heatmap cell colors.Fixed a bug in
FacetGrid
that appeared when usingcol_wrap
with missingcol
levels.Made it possible to pass a tick locator object to the
heatmap()
colorbar.Made it possible to use different styles (e.g., step) for
PairGrid
histograms when there are multiple hue levels.Fixed a bug in scipy-based univariate kernel density bandwidth calculation.
The
reset_orig()
function (and, by extension, importingseaborn.apionly
) resets matplotlib rcParams to their values at the time seaborn itself was imported, which should work better with rcParams changed by the jupyter notebook backend.Removed some objects from the top-level
seaborn
namespace.Improved unicode compatibility in
FacetGrid
.
v0.7.0 (January 2016)¶
This is a major release from 0.6. The main new feature is swarmplot()
which implements the beeswarm approach for drawing categorical scatterplots. There are also some performance improvements, bug fixes, and updates for compatibility with new versions of dependencies.
Added the
swarmplot()
function, which draws beeswarm plots. These are categorical scatterplots, similar to those produced bystripplot()
, but position of the points on the categorical axis is chosen to avoid overlapping points. See the categorical plot tutorial for more information.Changed some of the
stripplot()
defaults to be closer toswarmplot()
. Points are now somewhat smaller, have no outlines, and are not split by default when usinghue
. These settings remain customizable through function parameters.Added an additional rule when determining category order in categorical plots. Now, when numeric variables are used in a categorical role, the default behavior is to sort the unique levels of the variable (i.e they will be in proper numerical order). This can still be overridden by the appropriate
{*_}order
parameter, and variables with acategory
datatype will still follow the category order even if the levels are strictly numerical.Changed how
stripplot()
draws points when usinghue
nesting withsplit=False
so that the differenthue
levels are not drawn strictly on top of each other.Improve performance for large dendrograms in
clustermap()
.Added
font.size
to the plotting context definition so that the default output fromplt.text
will be scaled appropriately.Fixed a bug in
clustermap()
whenfastcluster
is not installed.Fixed a bug in the zscore calculation in
clustermap()
.Fixed a bug in
distplot()
where sometimes the default number of bins would not be an integer.Fixed a bug in
stripplot()
where a legend item would not appear for ahue
level if there were no observations in the first group of points.Heatmap colorbars are now rasterized for better performance in vector plots.
Added workarounds for some matplotlib boxplot issues, such as strange colors of outlier points.
Added workarounds for an issue where violinplot edges would be missing or have random colors.
Added a workaround for an issue where only one
heatmap()
cell would be annotated on some matplotlib backends.Fixed a bug on newer versions of matplotlib where a colormap would be erroneously applied to scatterplots with only three observations.
Updated seaborn for compatibility with matplotlib 1.5.
Added compatibility for various IPython (and Jupyter) versions in functions that use widgets.
v0.6.0 (June 2015)¶
This is a major release from 0.5. The main objective of this release was to unify the API for categorical plots, which means that there are some relatively large API changes in some of the older functions. See below for details of those changes, which may break code written for older versions of seaborn. There are also some new functions (stripplot()
, and countplot()
), numerous enhancements to existing functions, and bug fixes.
Additionally, the documentation has been completely revamped and expanded for the 0.6 release. Now, the API docs page for each function has multiple examples with embedded plots showing how to use the various options. These pages should be considered the most comprehensive resource for examples, and the tutorial pages are now streamlined and oriented towards a higher-level overview of the various features.
Changes and updates to categorical plots¶
In version 0.6, the “categorical” plots have been unified with a common API. This new category of functions groups together plots that show the relationship between one numeric variable and one or two categorical variables. This includes plots that show distribution of the numeric variable in each bin (boxplot()
, violinplot()
, and stripplot()
) and plots that apply a statistical estimation within each bin (pointplot()
, barplot()
, and countplot()
). There is a new tutorial chapter that introduces these functions.
The categorical functions now each accept the same formats of input data and can be invoked in the same way. They can plot using long- or wide-form data, and can be drawn vertically or horizontally. When long-form data is used, the orientation of the plots is inferred from the types of the input data. Additionally, all functions natively take a hue
variable to add a second layer of categorization.
With the (in some cases new) API, these functions can all be drawn correctly by FacetGrid
. However, factorplot
can also now create faceted verisons of any of these kinds of plots, so in most cases it will be unnecessary to use FacetGrid
directly. By default, factorplot
draws a point plot, but this is controlled by the kind
parameter.
Here are details on what has changed in the process of unifying these APIs:
Changes to
boxplot()
andviolinplot()
will probably be the most disruptive. Both functions maintain backwards-compatibility in terms of the kind of data they can accept, but the syntax has changed to be more similar to other seaborn functions. These functions are now invoked withx
and/ory
parameters that are either vectors of data or names of variables in a long-form DataFrame passed to the newdata
parameter. You can still pass wide-form DataFrames or arrays todata
, but it is no longer the first positional argument. See the github pull request (#410) for more information on these changes and the logic behind them.As
pointplot()
andbarplot()
can now plot with the major categorical variable on the y axis, thex_order
parameter has been renamed toorder
.Added a
hue
argument toboxplot()
andviolinplot()
, which allows for nested grouping the plot elements by a third categorical variable. Forviolinplot()
, this nesting can also be accomplished by splitting the violins when there are two levels of thehue
variable (usingsplit=True
). To make this functionality feasible, the ability to specify where the plots will be draw in data coordinates has been removed. These plots now are drawn at set positions, like (and identical to)barplot()
andpointplot()
.Added a
palette
parameter toboxplot()
/violinplot()
. Thecolor
parameter still exists, but no longer does double-duty in accepting the name of a seaborn palette.palette
supersedescolor
so that it can be used with aFacetGrid
.
Along with these API changes, the following changes/enhancements were made to the plotting functions:
The default rules for ordering the categories has changed. Instead of automatically sorting the category levels, the plots now show the levels in the order they appear in the input data (i.e., the order given by
Series.unique()
). Order can be specified when plotting with theorder
andhue_order
parameters. Additionally, when variables are pandas objects with a “categorical” dtype, the category order is inferred from the data object. This change also affectsFacetGrid
andPairGrid
.Added the
scale
andscale_hue
parameters toviolinplot()
. These control how the width of the violins are scaled. The default isarea
, which is different from how the violins used to be drawn. Usescale='width'
to get the old behavior.Used a different style for the
box
kind of interior plot inviolinplot()
, which shows the whisker range in addition to the quartiles. Useinner='quartile'
to get the old style.
New plotting functions¶
Added the
stripplot()
function, which draws a scatterplot where one of the variables is categorical. This plot has the same API asboxplot()
andviolinplot()
. It is useful both on its own and when composed with one of these other plot kinds to show both the observations and underlying distribution.Added the
countplot()
function, which uses a bar plot representation to show counts of variables in one or more categorical bins. This replaces the old approach of callingbarplot()
without a numeric variable.
Other additions and changes¶
The
corrplot()
and underlyingsymmatplot()
functions have been deprecated in favor ofheatmap()
, which is much more flexible and robust. These two functions are still available in version 0.6, but they will be removed in a future version.Added the
set_color_codes()
function and thecolor_codes
argument toset()
andset_palette()
. This changes the interpretation of shorthand color codes (i.e. “b”, “g”, k”, etc.) within matplotlib to use the values from one of the named seaborn palettes (i.e. “deep”, “muted”, etc.). That makes it easier to have a more uniform look when using matplotlib functions directly with seaborn imported. This could be disruptive to existing plots, so it does not happen by default. It is possible this could change in the future.The
color_palette()
function no longer trims palettes that are longer than 6 colors when passed into it.Added the
as_hex
method to color palette objects, to return a list of hex codes rather than rgb tuples.jointplot()
now passes additional keyword arguments to the function used to draw the plot on the joint axes.Changed the default
linewidths
inheatmap()
andclustermap()
to 0 so that larger matrices plot correctly. This parameter still exists and can be used to get the old effect of lines demarcating each cell in the heatmap (the old defaultlinewidths
was 0.5).heatmap()
andclustermap()
now automatically use a mask for missing values, which previously were shown with the “under” value of the colormap per defaultplt.pcolormesh
behavior.Added the
seaborn.crayons
dictionary and thecrayon_palette()
function to define colors from the 120 box (!) of Crayola crayons.Added the
line_kws
parameter toresidplot()
to change the style of the lowess line, when used.Added open-ended
**kwargs
to theadd_legend
method onFacetGrid
andPairGrid
, which will pass additional keyword arguments through when calling the legend function on theFigure
orAxes
.Added the
gridspec_kws
parameter toFacetGrid
, which allows for control over the size of individual facets in the grid to emphasize certain plots or account for differences in variable ranges.The interactive palette widgets now show a continuous colorbar, rather than a discrete palette, when
as_cmap
is True.The default Axes size for
pairplot()
andPairGrid
is now slightly smaller.Added the
shade_lowest
parameter tokdeplot()
which will set the alpha for the lowest contour level to 0, making it easier to plot multiple bivariate distributions on the same axes.The
height
parameter ofrugplot()
is now interpreted as a function of the axis size and is invariant to changes in the data scale on that axis. The rug lines are also slightly narrower by default.Added a catch in
distplot()
when calculating a default number of bins. For highly skewed data it will now use sqrt(n) bins, where previously the reference rule would return “infinite” bins and cause an exception in matplotlib.Added a ceiling (50) to the default number of bins used for
distplot()
histograms. This will help avoid confusing errors with certain kinds of datasets that heavily violate the assumptions of the reference rule used to get a default number of bins. The ceiling is not applied when passing a specific number of bins.The various property dictionaries that can be passed to
plt.boxplot
are now applied after the seaborn restyling to allow for full customizability.Added a
savefig
method toJointGrid
that defaults to a tight bounding box to make it easier to save figures using this class, and set a tight bbox as the default for thesavefig
method on other Grid objects.You can now pass an integer to the
xticklabels
andyticklabels
parameter ofheatmap()
(and, by extension,clustermap()
). This will make the plot use the ticklabels inferred from the data, but only plot everyn
label, wheren
is the number you pass. This can help when visualizing larger matrices with some sensible ordering to the rows or columns of the dataframe.Added
"figure.facecolor"
to the style parameters and set the default to white.The
load_dataset()
function now caches datasets locally after downloading them, and uses the local copy on subsequent calls.
Bug fixes¶
Fixed bugs in
clustermap()
where the mask and specified ticklabels were not being reorganized using the dendrograms.Fixed a bug in
FacetGrid
andPairGrid
that lead to incorrect legend labels when levels of thehue
variable appeared inhue_order
but not in the data.Fixed a bug in
FacetGrid.set_xticklabels()
orFacetGrid.set_yticklabels()
whencol_wrap
is being used.Fixed a bug in
PairGrid
where thehue_order
parameter was ignored.Fixed two bugs in
despine()
that caused errors when trying to trim the spines on plots that had inverted axes or no ticks.Improved support for the
margin_titles
option inFacetGrid
, which can now be used with a legend.
v0.5.1 (November 2014)¶
This is a bugfix release that includes a workaround for an issue in matplotlib 1.4.2 and fixes for two bugs in functions that were new in 0.5.0.
Implemented a workaround for a bug in matplotlib 1.4.2 that prevented point markers from being drawn when the seaborn styles had been set. See this github issue for more information.
Fixed a bug in
heatmap()
where the mask was vertically reversed relative to the data.Fixed a bug in
clustermap()
when using nested lists of side colors.
v0.5.0 (November 2014)¶
This is a major release from 0.4. Highlights include new functions for plotting heatmaps, possibly while applying clustering algorithms to discover structured relationships. These functions are complemented by new custom colormap functions and a full set of IPython widgets that allow interactive selection of colormap parameters. The palette tutorial has been rewritten to cover these new tools and more generally provide guidance on how to use color in visualizations. There are also a number of smaller changes and bugfixes.
Plotting functions¶
Added the
heatmap()
function for visualizing a matrix of data by color-encoding the values. See the docs for more information.Added the
clustermap()
function for clustering and visualizing a matrix of data, with options to label individual rows and columns by colors. See the docs for more information. This work was lead by Olga Botvinnik.lmplot()
andpairplot()
get a new keyword argument,markers
. This can be a single kind of marker or a list of different markers for each level of thehue
variable. Using different markers for different hues should let plots be more comprehensible when reproduced to black-and-white (i.e. when printed). See the github pull request (#323) for examples.More generally, there is a new keyword argument in
FacetGrid
andPairGrid
,hue_kws
. This similarly lets plot aesthetics vary across the levels of the hue variable, but more flexibily.hue_kws
should be a dictionary that maps the name of keyword arguments to lists of values that are as long as the number of levels of the hue variable.The argument
subplot_kws
has been added toFacetGrid
. This allows for faceted plots with custom projections, including maps with Cartopy.
Color palettes¶
Added two new functions to create custom color palettes. For sequential palettes, you can use the
light_palette()
function, which takes a seed color and creates a ramp from a very light, desaturated variant of it. For diverging palettes, you can use thediverging_palette()
function to create a balanced ramp between two endpoints to a light or dark midpoint. See the palette tutorial for more information.Added the ability to specify the seed color for
light_palette()
anddark_palette()
as a tuple ofhusl
orhls
space values or as a namedxkcd
color. The interpretation of the seed color is now provided by the newinput
parameter to these functions.Added several new interactive palette widgets:
choose_colorbrewer_palette()
,choose_light_palette()
,choose_dark_palette()
, andchoose_diverging_palette()
. For consistency, renamed the cubehelix widget tochoose_cubehelix_palette()
(and fixed a bug where the cubehelix palette was reversed). These functions also now return either a color palette list or a matplotlib colormap when called, and that object will be live-updated as you play with the widget. This should make it easy to iterate over a plot until you find a good representation for the data. See the Github pull request or this notebook (download it to use the widgets) for more information.Overhauled the color palette tutorial to organize the discussion by class of color palette and provide more motivation behind the various choices one might make when choosing colors for their data.
Bug fixes¶
Fixed a bug in
PairGrid
that gave incorrect results (or a crash) when the input DataFrame has a non-default index.Fixed a bug in
PairGrid
where passing columns with a date-like datatype raised an exception.Fixed a bug where
lmplot()
would show a legend when the hue variable was also used on either the rows or columns (making the legend redundant).Worked around a matplotlib bug that was forcing outliers in
boxplot()
to appear as blue.kdeplot()
now accepts pandas Series for thedata
anddata2
arguments.Using a non-default correlation method in
corrplot()
now impliessig_stars=False
as the permutation test used to significance values for the correlations uses a pearson metric.Removed
pdf.fonttype
from the style definitions, as the value used in version 0.4 resulted in very large PDF files.
v0.4.0 (September 2014)¶
This is a major release from 0.3. Highlights include new approaches for quick, high-level dataset exploration (along with a more flexible interface) and easy creation of perceptually-appropriate color palettes using the cubehelix system. Along with these additions, there are a number of smaller changes that make visualizing data with seaborn easier and more powerful.
Plotting functions¶
A new object,
PairGrid
, and a corresponding functionpairplot()
, for drawing grids of pairwise relationships in a dataset. This style of plot is sometimes called a “scatterplot matrix”, but the representation of the data inPairGrid
is flexible and many styles other than scatterplots can be used. See the docs for more information. Note: due to a bug in older versions of matplotlib, you will have best results if you use these functions with matplotlib 1.4 or later.The rules for choosing default color palettes when variables are mapped to different colors have been unified (and thus changed in some cases). Now when no specific palette is requested, the current global color palette will be used, unless the number of variables to be mapped exceeds the number of unique colors in the palette, in which case the
"husl"
palette will be used to avoid cycling.Added a keyword argument
hist_norm
todistplot()
. When adistplot()
is now drawn without a KDE or parametric density, the histogram is drawn as counts instead of a density. This can be overridden by by settinghist_norm
toTrue
.When using
FacetGrid
with ahue
variable, the legend is no longer drawn by default when you callFacetGrid.map()
. Instead, you have to callFacetGrid.add_legend()
manually. This should make it easier to layer multiple plots onto the grid without having duplicated legends.Made some changes to
factorplot
so that it behaves better when not all levels of thex
variable are represented in each facet.Added the
logx
option toregplot()
for fitting the regression in log space.When
violinplot()
encounters a bin with only a single observation, it will now plot a horizontal line at that value instead of erroring out.
Style and color palettes¶
Added the
cubehelix_palette()
function for generating sequential palettes from the cubehelix system. See the palette docs for more information on how these palettes can be used. There is also thechoose_cubehelix()
which will launch an interactive app to select cubehelix parameters in the notebook.Added the
xkcd_palette()
and thexkcd_rgb
dictionary so that colors can be specified with names from the xkcd color survey.Added the
font_scale
option toplotting_context()
,set_context()
, andset()
.font_scale
can independently increase or decrease the size of the font elements in the plot.Font-handling should work better on systems without Arial installed. This is accomplished by adding the
font.sans-serif
field to theaxes_style
definition with Arial and Liberation Sans prepended to matplotlib defaults. The font family can also be set through thefont
keyword argument inset()
. Due to matplotlib bugs, this might not work as expected on matplotlib 1.3.The
despine()
function gets a new keyword argumentoffset
, which replaces the deprecatedoffset_spines()
function. You no longer need to offset the spines before plotting data.Added a default value for
pdf.fonttype
so that text in PDFs is editable in Adobe Illustrator.
Other API Changes¶
Removed the deprecated
set_color_palette
andpalette_context
functions. These were replaced in version 0.3 by theset_palette()
function and ability to usecolor_palette()
directly in awith
statement.Removed the ability to specify a
nogrid
style, which was renamed towhite
in 0.3.
v0.3.1 (April 2014)¶
This is a minor release from 0.3 with fixes for several bugs.
Plotting functions¶
The size of the points in
pointplot()
andfactorplot
are now scaled with the linewidth for better aesthetics across different plotting contexts.The
pointplot()
glyphs for different levels of the hue variable are drawn at different z-orders so that they appear uniform.
Bug Fixes¶
Fixed a bug in
FacetGrid
(and thus affecting lmplot and factorplot) that appeared whencol_wrap
was used with a number of facets that did not evenly divide into the column width.Fixed an issue where the support for kernel density estimates was sometimes computed incorrectly.
Fixed a problem where
hue
variable levels that were not strings were missing inFacetGrid
legends.When passing a color palette list in a
with
statement, the entire palette is now used instead of the first six colors.
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.
v0.2.1 (December 2013)¶
This is a bugfix release, with no new features.
Bug fixes¶
Changed the mechanics of
violinplot()
andboxplot()
when using aSeries
object as data and performing agroupby
to assign data to bins to address a problem that arises in Pandas 0.13.Additionally fixed the
groupby
code to work with all styles of group specification (specifically, using a dictionary or a function now works).Fixed a bug where artifacts from the kde fitting could undershoot and create a plot where the density axis starts below 0.
Ensured that data used for kde fitting is double-typed to avoid a low-level statsmodels error.
Changed the implementation of the histogram bin-width reference rule to take a ceiling of the estimated number of bins.
v0.2.0 (December 2013)¶
This is a major release from 0.1 with a number of API changes, enhancements, and bug fixes.
Highlights include an overhaul of timeseries plotting to work intelligently
with dataframes, the new function interactplot()
for visualizing continuous
interactions, bivariate kernel density estimates in kdeplot()
, and
significant improvements to color palette handling.
Version 0.2 also introduces experimental support for Python 3.
In addition to the library enhancements, the documentation has been substantially rewritten to reflect the new features and improve the presentation of the ideas behind the package.
API changes¶
The
tsplot()
function was rewritten to accept data in a long-formDataFrame
and to plot different traces by condition. This introduced a relatively minor but unavoidable API change, where instead of doingsns.tsplot(time, heights)
, you now must dosns.tsplot(heights, time=time)
(thetime
parameter is now optional, for quicker specification of simple plots). Additionally, the"obs_traces"
and"obs_points"
error styles intsplot()
have been renamed to"unit_traces"
and"unit_points"
, respectively.Functions that fit kernel density estimates (
kdeplot()
andviolinplot()
) now usestatsmodels
instead ofscipy
, and the parameters that influence the density estimate have changed accordingly. This allows for increased flexibility in specifying the bandwidth and kernel, and smarter choices for defining the range of the support. Default options should produce plots that are very close to the old defaults.The
kdeplot()
function now takes a second positional argument of data for drawing bivariate densities.The
violin()
function has been changed toviolinplot()
, for consistency. In 0.2,violin
will still work, but it will fire aUserWarning
.
New plotting functions¶
The
interactplot()
function draws a contour plot for an interactive linear model (i.e., the contour showsy-hat
from the modely ~ x1 * x2
) over a scatterplot between the two predictor variables. This plot should aid the understanding of an interaction between two continuous variables.The
kdeplot()
function can now draw a bivariate density estimate as a contour plot if provided with two-dimensional input data.The
palplot()
function provides a simple grid-based visualization of a color palette.
Other changes¶
Plotting functions¶
The
corrplot()
function can be drawn without the correlation coefficient annotation and with variable names on the side of the plot to work with large datasets.Additionally,
corrplot()
sets the color palette intelligently based on the direction of the specified test.The
distplot()
histogram uses a reference rule to choose the bin size if it is not provided.Added the
x_bins
option inlmplot()
for binning a continuous predictor variable, allowing for clearer trends with many datapoints.Enhanced support for labeling plot elements and axes based on
name
attributes in several distribution plot functions andtsplot()
for smarter Pandas integration.Scatter points in
lmplot()
are slightly transparent so it is easy to see where observations overlap.Added the
order
parameter toboxplot()
andviolinplot()
to control the order of the bins when using a Pandas object.When an
ax
argument is not provided to a plotting function, it grabs the currently active axis instead of drawing a new one.
Color palettes¶
Added the
dark_palette()
andblend_palette()
for on-the-fly creation of blended color palettes.The color palette machinery is now intelligent about qualitative ColorBrewer palettes (
Set1
,Paired
, etc.), which are properly treated as discrete.Seaborn color palettes (
deep
,muted
, etc.) have been standardized in terms of basic hue sequence, and all palettes now have 6 colors.Introduced
{mpl_palette}_d
palettes, which make a palette with the basic color scheme of the source palette, but with a sequential blend from dark instead of light colors for use with line/scatter/contour plots.Added the
palette_context()
function for blockwise color palettes controlled by awith
statement.
Plot styling¶
Added the
despine()
function for easily removing plot spines.A new plot style,
"ticks"
has been added.Tick labels are padded a bit farther from the axis in all styles, avoiding collisions at (0, 0).
General package issues¶
Reorganized the package by breaking up the monolithic
plotobjs
module into smaller modules grouped by general objective of the constituent plots.Removed the
scikits-learn
dependency inmoss
.Installing with
pip
should automatically install most missing dependencies.The example notebooks are now used as an automated test suite.
Bug fixes¶
Fixed a bug where labels did not match data for
boxplot()
andviolinplot()
when using a groupby.Fixed a bug in the
desaturate()
function.Fixed a bug in the
coefplot()
figure size calculation.Fixed a bug where
regplot()
choked on list input.Fixed buggy behavior when drawing horizontal boxplots.
Specifying bins for the
distplot()
histogram now works.Fixed a bug where
kdeplot()
would reset the axis height and cut off existing data.All axis styling has been moved out of the top-level
seaborn.set()
function, so context or color palette can be cleanly changed.