Skip to content

Commit 021a20f

Browse files
authored
Don't pass label when creating color cycle scout (#3116)
* Don't pass label when creating color cycle scout * Update release notes
1 parent 852ffaf commit 021a20f

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

doc/whatsnew/v0.12.2.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@
22
v0.12.2 (Unreleased)
33
--------------------
44

5-
- Added the :class:`objects.KDE` stat (:pr:`3111`).
5+
- |Feature| Added the :class:`objects.KDE` stat (:pr:`3111`).
6+
7+
- |Fix| Fixed a regression in v0.12.0 where manually-added labels could have duplicate legend entries (:pr:`3116`).

seaborn/utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ def _default_color(method, hue, color, kws):
9595
# warnings.warn(msg)
9696
return None
9797

98+
kws = kws.copy()
99+
kws.pop("label", None)
100+
98101
if color is not None:
99102
return color
100103

tests/test_distributions.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1816,6 +1816,13 @@ def test_step_line_kwargs(self, flat_series):
18161816
assert line.get_linewidth() == lw
18171817
assert line.get_linestyle() == ls
18181818

1819+
def test_label(self, flat_series):
1820+
1821+
ax = histplot(flat_series, label="a label")
1822+
handles, labels = ax.get_legend_handles_labels()
1823+
assert len(handles) == 1
1824+
assert labels == ["a label"]
1825+
18191826

18201827
class TestHistPlotBivariate:
18211828

0 commit comments

Comments
 (0)