Skip to content

Commit

Permalink
Don't pass label when creating color cycle scout (#3116)
Browse files Browse the repository at this point in the history
* Don't pass label when creating color cycle scout

* Update release notes
  • Loading branch information
mwaskom authored Oct 28, 2022
1 parent 852ffaf commit 021a20f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
4 changes: 3 additions & 1 deletion doc/whatsnew/v0.12.2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
v0.12.2 (Unreleased)
--------------------

- Added the :class:`objects.KDE` stat (:pr:`3111`).
- |Feature| Added the :class:`objects.KDE` stat (:pr:`3111`).

- |Fix| Fixed a regression in v0.12.0 where manually-added labels could have duplicate legend entries (:pr:`3116`).
3 changes: 3 additions & 0 deletions seaborn/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ def _default_color(method, hue, color, kws):
# warnings.warn(msg)
return None

kws = kws.copy()
kws.pop("label", None)

if color is not None:
return color

Expand Down
7 changes: 7 additions & 0 deletions tests/test_distributions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1816,6 +1816,13 @@ def test_step_line_kwargs(self, flat_series):
assert line.get_linewidth() == lw
assert line.get_linestyle() == ls

def test_label(self, flat_series):

ax = histplot(flat_series, label="a label")
handles, labels = ax.get_legend_handles_labels()
assert len(handles) == 1
assert labels == ["a label"]


class TestHistPlotBivariate:

Expand Down

0 comments on commit 021a20f

Please sign in to comment.