diff --git a/doc/releases/v0.12.0.txt b/doc/releases/v0.12.0.txt index 3423a79100..822d7ef6f3 100644 --- a/doc/releases/v0.12.0.txt +++ b/doc/releases/v0.12.0.txt @@ -53,6 +53,8 @@ Other updates - |Enhancement| When using :func:`pairplot` with `corner=True` and `diag_kind=None`, the top left y axis label is no longer hidden (:pr:2850`). +- |Enhancement| Error bars in :func:`regplot` now inherit the alpha value of the points they correspond to (:pr:`2540`). + - |Fix| Fixed a regression in 0.11.2 that caused some functions to stall indefinitely or raise when the input data had a duplicate index (:pr:`2776`). - |Fix| Fixed a bug in :func:`histplot` and :func:`kdeplot` where weights were not factored into the normalization (:pr:`2812`). diff --git a/seaborn/regression.py b/seaborn/regression.py index d0700f73f7..a6b1087338 100644 --- a/seaborn/regression.py +++ b/seaborn/regression.py @@ -396,6 +396,8 @@ def scatterplot(self, ax, kws): else: # TODO abstraction ci_kws = {"color": kws["color"]} + if "alpha" in kws: + ci_kws["alpha"] = kws["alpha"] ci_kws["linewidth"] = mpl.rcParams["lines.linewidth"] * 1.75 kws.setdefault("s", 50) diff --git a/tests/test_regression.py b/tests/test_regression.py index f84c9398a9..280599e673 100644 --- a/tests/test_regression.py +++ b/tests/test_regression.py @@ -522,6 +522,14 @@ def test_regplot_scatter_kws_alpha(self): scatter_kws={'color': color}) assert ax.collections[0]._alpha == 0.8 + f, ax = plt.subplots() + alpha = .3 + ax = lm.regplot(x="x", y="y", data=self.df, + x_bins=5, fit_reg=False, + scatter_kws={"alpha": alpha}) + for line in ax.lines: + assert line.get_alpha() == alpha + def test_regplot_binned(self): ax = lm.regplot(x="x", y="y", data=self.df, x_bins=5)