<h2 dir="auto">Observed behavior</h2>
<p dir="auto">When creating a <code class="notranslate">histplot</code> with a legend, duplicate labels show up in the legend. It seems to be creating entries in the legend for more than one <code class="notranslate">BarContainer</code> artist.</p>
<h2 dir="auto">Expected behavior</h2>
<p dir="auto">A single entry in the legend for the histogram. In my use case, this histogram is part of a collection of overlaid plots on the same axes, and the legend is required so that the various plot artists are clearly labeled.</p>
<h2 dir="auto">Minimal example</h2>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import numpy as np
import seaborn as sns

rng = np.random.default_rng(43)
data = rng.random(1000)
ax = sns.histplot(data, label=&quot;Random Data&quot;, stat=&quot;density&quot;)
ax.legend()

# Multiple artists are shown here
ax.get_legend_handles_labels()"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">numpy</span> <span class="pl-k">as</span> <span class="pl-s1">np</span>
<span class="pl-k">import</span> <span class="pl-s1">seaborn</span> <span class="pl-k">as</span> <span class="pl-s1">sns</span>

<span class="pl-s1">rng</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-s1">random</span>.<span class="pl-en">default_rng</span>(<span class="pl-c1">43</span>)
<span class="pl-s1">data</span> <span class="pl-c1">=</span> <span class="pl-s1">rng</span>.<span class="pl-en">random</span>(<span class="pl-c1">1000</span>)
<span class="pl-s1">ax</span> <span class="pl-c1">=</span> <span class="pl-s1">sns</span>.<span class="pl-en">histplot</span>(<span class="pl-s1">data</span>, <span class="pl-s1">label</span><span class="pl-c1">=</span><span class="pl-s">"Random Data"</span>, <span class="pl-s1">stat</span><span class="pl-c1">=</span><span class="pl-s">"density"</span>)
<span class="pl-s1">ax</span>.<span class="pl-en">legend</span>()

<span class="pl-c"># Multiple artists are shown here</span>
<span class="pl-s1">ax</span>.<span class="pl-en">get_legend_handles_labels</span>()</pre></div>
<h2 dir="auto">Outputs from minimal example</h2>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/1363287/198343727-e4b2588f-ec9f-4af8-8d22-c276b5a6c151.png"><img src="https://user-images.githubusercontent.com/1363287/198343727-e4b2588f-ec9f-4af8-8d22-c276b5a6c151.png" alt="image" style="max-width: 100%;"></a></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="([&lt;BarContainer object of 1 artists&gt;, &lt;BarContainer object of 11 artists&gt;],
 ['Random Data', 'Random Data'])"><pre class="notranslate"><code class="notranslate">([&lt;BarContainer object of 1 artists&gt;, &lt;BarContainer object of 11 artists&gt;],
 ['Random Data', 'Random Data'])
</code></pre></div>
<h2 dir="auto">Version</h2>
<p dir="auto">Version where behavior is observed: 0.12.1<br>
This behavior was not present in 0.11.2.</p>
<p dir="auto">Using joinplot( type = 'hex' ) to make hexbin plot.</p>
<p dir="auto">The function call hangs (never comes back, with 100% CPU usage) when I tried to do it with my data (variables a and b)</p>
<p dir="auto">The same plot works for randomly generated data (variables x and y)</p>
<p dir="auto">This Jupyter notebook provides data for both working and buggy behavior.  <a href="https://github.com/odoublewen/seaborn_bug/blob/master/seaborn_test.ipynb">https://github.com/odoublewen/seaborn_bug/blob/master/seaborn_test.ipynb</a></p>
<p dir="auto">Cheers</p>