这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions doc/releases/v0.12.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ A paper describing seaborn was published in the `Journal of Open Source Software

- |Enhancement| In :func:`kdeplot`, added the `warn_singular` parameter to allow silencing of the warning about data with zero variance (:pr:`2566`).

- |Enhancement| In :class:`FacetGrid`, :class:`PairGrid`, and functions that use them, the matplotlib `figure.autolayout` parameter is disabled to avoid having the legend overlap the plot (:pr:`2571`).

- |Enhancement| |Fix| Improved integration with the matplotlib color cycle in most axes-level functions (:pr:`2449`).

- |Fix| In :func:`lineplot, allowed the `dashes` keyword to set the style of a line without mapping a `style` variable (:pr:`2449`).
Expand Down
25 changes: 16 additions & 9 deletions seaborn/axisgrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,14 +373,19 @@ def __init__(
subplot_kws["ylim"] = ylim

# --- Initialize the subplot grid

# Disable autolayout so legend_out works properly
with mpl.rc_context({"figure.autolayout": False}):
fig = plt.figure(figsize=figsize)

if col_wrap is None:

kwargs = dict(figsize=figsize, squeeze=False,
kwargs = dict(squeeze=False,
sharex=sharex, sharey=sharey,
subplot_kw=subplot_kws,
gridspec_kw=gridspec_kws)

fig, axes = plt.subplots(nrow, ncol, **kwargs)
axes = fig.subplots(nrow, ncol, **kwargs)

if col is None and row is None:
axes_dict = {}
Expand All @@ -399,7 +404,6 @@ def __init__(
warnings.warn("`gridspec_kws` ignored when using `col_wrap`")

n_axes = len(col_names)
fig = plt.figure(figsize=figsize)
axes = np.empty(n_axes, object)
axes[0] = fig.add_subplot(nrow, ncol, 1, **subplot_kws)
if sharex:
Expand Down Expand Up @@ -533,7 +537,7 @@ def __init__(
gridspec_kws : dict
Dictionary of keyword arguments passed to
:class:`matplotlib.gridspec.GridSpec`
(via :func:`matplotlib.pyplot.subplots`).
(via :meth:`matplotlib.figure.Figure.subplots`).
Ignored if ``col_wrap`` is not ``None``.

See Also
Expand Down Expand Up @@ -1173,16 +1177,19 @@ def __init__(
# Create the figure and the array of subplots
figsize = len(x_vars) * height * aspect, len(y_vars) * height

fig, axes = plt.subplots(len(y_vars), len(x_vars),
figsize=figsize,
sharex="col", sharey="row",
squeeze=False)
# Disable autolayout so legend_out works
with mpl.rc_context({"figure.autolayout": False}):
fig = plt.figure(figsize=figsize)

axes = fig.subplots(len(y_vars), len(x_vars),
sharex="col", sharey="row",
squeeze=False)

# Possibly remove upper axes to make a corner grid
# Note: setting up the axes is usually the most time-intensive part
# of using the PairGrid. We are foregoing the speed improvement that
# we would get by just not setting up the hidden axes so that we can
# avoid implementing plt.subplots ourselves. But worth thinking about.
# avoid implementing fig.subplots ourselves. But worth thinking about.
self._corner = corner
if corner:
hide_indices = np.triu_indices_from(axes, 1)
Expand Down