v0.13.0 (September 2023) #3507
mwaskom
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
See the online docs for an annotated version of these notes with working links.
This is a major release with a number of important new features and changes. The highlight is a major overhaul to seaborn's categorical plotting functions, providing them with many new capabilities and better aligning their API with the rest of the library. There is also provisional support for alternate dataframe libraries like polars, a new theme and display configuration system for
objects.Plot
, and many smaller bugfixes and enhancements.Updating is recommended, but users are encouraged to carefully check the outputs of existing code that uses the categorical functions, and they should be aware of some deprecations and intentional changes to the default appearance of the resulting plots (see notes below with and tags).
Major enhancements to categorical plots
Seaborn's
categorical functions <categorical_api>
have been completely rewritten for this release. This provided the opportunity to address some longstanding quirks as well as to add a number of smaller but much-desired features and enhancements.Support for numeric and datetime data
The categorical functions have historically treated all data as categorical, even when it has a numeric or datetime type. This can now be controlled with the new native_scale parameter. The default remains False to preserve existing behavior. But with native_scale=True, values will be treated as they would by other seaborn or matplotlib functions. Element widths will be derived from the minimum distance between two unique values on the categorical axis.
Additionally, while seaborn previously determined the mapping from categorical values to ordinal positions internally, this is now delegated to matplotlib. The change should mostly be transparent to the user, but categorical plots (even with native_scale=False) will better align with artists added by other seaborn or matplotlib functions in most cases, and matplotlib's interactive machinery will work better.
Changes to color defaults and specification
The categorical functions now act more like the rest of seaborn in that they will produce a plot with a single main color unless the hue variable is assigned. Previously, there would be an implicit redundant color mapping (e.g., each box in a boxplot would get a separate color from the default palette). To retain the previous behavior, explicitly assign a redundant hue variable (e.g., boxplot(data, x="x", y="y", hue="x")).
Two related idiosyncratic color specifications are deprecated, but they will continue to work (with a warning) for one release cycle:
Finally, like other seaborn functions, the default palette now depends on the variable type, and a sequential palette will be used with numeric data. To retain the previous behavior, pass the name of a qualitative palette (e.g., palette="deep" for seaborn's default). Accordingly, the functions have gained a parameter to control numeric color mappings (hue_norm).
Other features, enhancements, and changes
The following updates apply to multiple categorical functions.
boxplot
,boxenplot
, andviolinplot
functions now support a single linecolor parameter.pointplot
or the kernel density fit inviolinplot
) are now applied in that scale space.The following updates are function-specific.
pointplot
, a singlematplotlib.lines.Line2D
artist is now used rather than adding separatematplotlib.collections.PathCollection
artist for the points. As a result, it is now possible to pass additional keyword arguments for complete customization the appearance of both the lines and markers; additionally, the legend representation is improved. Accordingly, parameters that previously allowed only partial customization (scale, join, and errwidth) are now deprecated. The old parameters will now trigger detailed warning messages with instructions for adapting existing code.violinplot
better aligns withkdeplot
, as the bw parameter is now deprecated in favor of bw_method and bw_adjust.boxenplot
, the boxen are now drawn with separate patch artists in each tail. This may have consequences for code that works with the underlying artists, but it produces a better result for low-alpha / unfilled plots and enables proper area/density scaling.barplot
, the errcolor and errwidth parameters are now deprecated in favor of a more general err_kws` dictionary. The existing parameters will continue to work for two releases.violinplot
, the scale and scale_hue parameters have been renamed to density_norm and common_norm for clarity and to reflect the fact that common normalization is now applied over both hue and faceting variables incatplot
.boxenplot
, the scale parameter has been renamed to width_method as part of a broader effort to de-confound the meaning of "scale" in seaborn parameters.barplot
orpointplot
, a bar or point will be drawn for each entry in the vector rather than plotting a single aggregated value. To retain the previous behavior, assign the vector to the y variable.boxplot
, the default flier marker now follows the matplotlib rcparams so that it can be globally customized.violinplot
, a separate mini-box is now drawn for each split violin.boxenplot
, all plots now use a consistent luminance ramp for the different box levels. This leads to a change in the appearance of existing plots, but reduces the chances of a misleading result.boxenplot
now approximates the density of the underlying observations, including for asymmetric distributions. This produces a substantial change in the appearance of plots with width_method="area", although the existing behavior was poorly defined.countplot
, the new stat parameter can be used to apply a normalization (e.g to show a "percent" or "proportion").violinplot
is now more general and can be set to True regardless of the number of hue variable levels (or even without hue). This is probably most useful for showing half violins.violinplot
, the new inner_kws parameter allows additional control over the interior artists.catplot
, as data vectors can now be passed directly.boxplot
, the artists that comprise each box plot are now packaged in a BoxPlotContainer for easier post-plotting access.Support for alternate dataframe libraries
3369
).Improved configuration for the objects interface
objects.Plot
(3223
)objects.Plot
(3225
).objects.Plot
via the new label parameter inobjects.Plot.add
(3456
).objects.Plot.scale
,objects.Plot.limit
, andobjects.Plot.label
the x / y parameters can be used to set a common scale / limit / label for paired subplots (3458
).Other updates
3467
).ecdfplot
, stat="percent" is now a valid option (3336
).3488
).histplot
, infinite values are now ignored when choosing the default bin range (3488
).3440
).load_dataset
to use an approach more compatible with pyiodide (3234
).3452
).histplot
, treatment of the binwidth parameter has changed such that the actual bin width will be only approximately equal to the requested width when that value does not evenly divide the bin range. This fixes an issue where the largest data value was sometimes dropped due to floating point error (3489
).objects.Bar
andobjects.Bars
widths when using a nonlinear scale (3217
).move_legend
when labels were provided (3454
).histplot
added a stray empty BarContainer (3246
).objects.Plot.on
would override a figure's layout engine (3216
).lineplot
with a list of tuples for the keyword argument dashes caused a TypeError (3316
).PairGrid
that caused an exception when the input dataframe had a column multiindex (3407
).3394
).This discussion was created from the release v0.13.0 (September 2023).
Beta Was this translation helpful? Give feedback.
All reactions