<p dir="auto">I'm not sure how much of an issue it is, but when upgrading from an older version of seaborn a new error was introduced in code that used to work in <code class="notranslate">0.11.1</code>, but is now broken in <code class="notranslate">0.11.2</code>.</p>
<p dir="auto">Code to reproduce is as follows:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="    import pandas as pd
    import seaborn as sns
    sns.set()
    import matplotlib.pyplot as plt  # NOQA

    n = 10
    to_stack = []
    for group_idx in range(3):
        part_data = pd.DataFrame({
            'bin': np.arange(n),
            'value': np.random.randint(0, 100, size=n),
            'group': [f'group_{group_idx}'] * n,
        })
        to_stack.append(part_data)
    data = pd.concat(to_stack)

    ax = plt.figure().gca()
    sns.histplot(ax=ax, data=data, bins=10, x='bin', weights='value', hue='group')"><pre class="notranslate">    <span class="pl-k">import</span> <span class="pl-s1">pandas</span> <span class="pl-k">as</span> <span class="pl-s1">pd</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">sns</span>.<span class="pl-en">set</span>()
    <span class="pl-k">import</span> <span class="pl-s1">matplotlib</span>.<span class="pl-s1">pyplot</span> <span class="pl-k">as</span> <span class="pl-s1">plt</span>  <span class="pl-c"># NOQA</span>

    <span class="pl-s1">n</span> <span class="pl-c1">=</span> <span class="pl-c1">10</span>
    <span class="pl-s1">to_stack</span> <span class="pl-c1">=</span> []
    <span class="pl-k">for</span> <span class="pl-s1">group_idx</span> <span class="pl-c1">in</span> <span class="pl-en">range</span>(<span class="pl-c1">3</span>):
        <span class="pl-s1">part_data</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-v">DataFrame</span>({
            <span class="pl-s">'bin'</span>: <span class="pl-s1">np</span>.<span class="pl-en">arange</span>(<span class="pl-s1">n</span>),
            <span class="pl-s">'value'</span>: <span class="pl-s1">np</span>.<span class="pl-s1">random</span>.<span class="pl-en">randint</span>(<span class="pl-c1">0</span>, <span class="pl-c1">100</span>, <span class="pl-s1">size</span><span class="pl-c1">=</span><span class="pl-s1">n</span>),
            <span class="pl-s">'group'</span>: [<span class="pl-s">f'group_<span class="pl-s1"><span class="pl-kos">{</span><span class="pl-s1">group_idx</span><span class="pl-kos">}</span></span>'</span>] <span class="pl-c1">*</span> <span class="pl-s1">n</span>,
        })
        <span class="pl-s1">to_stack</span>.<span class="pl-en">append</span>(<span class="pl-s1">part_data</span>)
    <span class="pl-s1">data</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-en">concat</span>(<span class="pl-s1">to_stack</span>)

    <span class="pl-s1">ax</span> <span class="pl-c1">=</span> <span class="pl-s1">plt</span>.<span class="pl-en">figure</span>().<span class="pl-en">gca</span>()
    <span class="pl-s1">sns</span>.<span class="pl-en">histplot</span>(<span class="pl-s1">ax</span><span class="pl-c1">=</span><span class="pl-s1">ax</span>, <span class="pl-s1">data</span><span class="pl-c1">=</span><span class="pl-s1">data</span>, <span class="pl-s1">bins</span><span class="pl-c1">=</span><span class="pl-c1">10</span>, <span class="pl-s1">x</span><span class="pl-c1">=</span><span class="pl-s">'bin'</span>, <span class="pl-s1">weights</span><span class="pl-c1">=</span><span class="pl-s">'value'</span>, <span class="pl-s1">hue</span><span class="pl-c1">=</span><span class="pl-s">'group'</span>)</pre></div>
<p dir="auto">The idea is we are displaying a histogram (where bins were already computed) for multiple groups.</p>
<p dir="auto">The resulting plot (from the working version) looks like this:</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/3186211/145621956-da07f200-e4c3-41f7-a1c1-9816f9dfcb5c.png"><img src="https://user-images.githubusercontent.com/3186211/145621956-da07f200-e4c3-41f7-a1c1-9816f9dfcb5c.png" alt="image" style="max-width: 100%;"></a></p>
<p dir="auto">But in <code class="notranslate">0.11.2</code> I got a new error: <code class="notranslate">ValueError: cannot reindex from a duplicate axis</code></p>
<p dir="auto">The traceback is:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
&lt;ipython-input-3-e7c80e367597&gt; in &lt;module&gt;
     16 
     17 ax = plt.figure().gca()
---&gt; 18 sns.histplot(ax=ax, data=data, bins=10, x='bin', weights='value', hue='group')

~/.pyenv/versions/3.8.6/envs/pyenv3.8.6/lib/python3.8/site-packages/seaborn/distributions.py in histplot(data, x, y, hue, weights, stat, bins, binwidth, binrange, discrete, cumulative, common_bins, common_norm, multiple, element, fill, shrink, kde, kde_kws, line_kws, thresh, pthresh, pmax, cbar, cbar_ax, cbar_kws, palette, hue_order, hue_norm, color, log_scale, legend, ax, **kwargs)
   1460     if p.univariate:
   1461 
-&gt; 1462         p.plot_univariate_histogram(
   1463             multiple=multiple,
   1464             element=element,

~/.pyenv/versions/3.8.6/envs/pyenv3.8.6/lib/python3.8/site-packages/seaborn/distributions.py in plot_univariate_histogram(self, multiple, element, fill, common_norm, common_bins, shrink, kde, kde_kws, color, legend, line_kws, estimate_kws, **plot_kws)
    398         if set(self.variables) - {&quot;x&quot;, &quot;y&quot;}:
    399 
--&gt; 400             all_data = self.comp_data.dropna()
    401 
    402             if common_bins:

~/.pyenv/versions/3.8.6/envs/pyenv3.8.6/lib/python3.8/site-packages/seaborn/_core.py in comp_data(self)
   1055                     orig = self.plot_data[var].dropna()
   1056                 comp_col = pd.Series(index=orig.index, dtype=float, name=var)
-&gt; 1057                 comp_col.loc[orig.index] = pd.to_numeric(axis.convert_units(orig))
   1058 
   1059                 if axis.get_scale() == &quot;log&quot;:

~/.pyenv/versions/3.8.6/envs/pyenv3.8.6/lib/python3.8/site-packages/pandas/core/indexing.py in __setitem__(self, key, value)
    721 
    722         iloc = self if self.name == &quot;iloc&quot; else self.obj.iloc
--&gt; 723         iloc._setitem_with_indexer(indexer, value, self.name)
    724 
    725     def _validate_key(self, key, axis: int):

~/.pyenv/versions/3.8.6/envs/pyenv3.8.6/lib/python3.8/site-packages/pandas/core/indexing.py in _setitem_with_indexer(self, indexer, value, name)
   1730             self._setitem_with_indexer_split_path(indexer, value, name)
   1731         else:
-&gt; 1732             self._setitem_single_block(indexer, value, name)
   1733 
   1734     def _setitem_with_indexer_split_path(self, indexer, value, name: str):

~/.pyenv/versions/3.8.6/envs/pyenv3.8.6/lib/python3.8/site-packages/pandas/core/indexing.py in _setitem_single_block(self, indexer, value, name)
   1957             # setting for extensionarrays that store dicts. Need to decide
   1958             # if it's worth supporting that.
-&gt; 1959             value = self._align_series(indexer, Series(value))
   1960 
   1961         elif isinstance(value, ABCDataFrame) and name != &quot;iloc&quot;:

~/.pyenv/versions/3.8.6/envs/pyenv3.8.6/lib/python3.8/site-packages/pandas/core/indexing.py in _align_series(self, indexer, ser, multiindex_indexer)
   2094             # series, so need to broadcast (see GH5206)
   2095             if sum_aligners == self.ndim and all(is_sequence(_) for _ in indexer):
-&gt; 2096                 ser = ser.reindex(obj.axes[0][indexer[0]], copy=True)._values
   2097 
   2098                 # single indexer

~/.pyenv/versions/3.8.6/envs/pyenv3.8.6/lib/python3.8/site-packages/pandas/core/series.py in reindex(self, index, **kwargs)
   4578     )
   4579     def reindex(self, index=None, **kwargs):
-&gt; 4580         return super().reindex(index=index, **kwargs)
   4581 
   4582     @deprecate_nonkeyword_arguments(version=None, allowed_args=[&quot;self&quot;, &quot;labels&quot;])

~/.pyenv/versions/3.8.6/envs/pyenv3.8.6/lib/python3.8/site-packages/pandas/core/generic.py in reindex(self, *args, **kwargs)
   4816 
   4817         # perform the reindex on the axes
-&gt; 4818         return self._reindex_axes(
   4819             axes, level, limit, tolerance, method, fill_value, copy
   4820         ).__finalize__(self, method=&quot;reindex&quot;)

~/.pyenv/versions/3.8.6/envs/pyenv3.8.6/lib/python3.8/site-packages/pandas/core/generic.py in _reindex_axes(self, axes, level, limit, tolerance, method, fill_value, copy)
   4837 
   4838             axis = self._get_axis_number(a)
-&gt; 4839             obj = obj._reindex_with_indexers(
   4840                 {axis: [new_index, indexer]},
   4841                 fill_value=fill_value,

~/.pyenv/versions/3.8.6/envs/pyenv3.8.6/lib/python3.8/site-packages/pandas/core/generic.py in _reindex_with_indexers(self, reindexers, fill_value, copy, allow_dups)
   4881 
   4882             # TODO: speed up on homogeneous DataFrame objects
-&gt; 4883             new_data = new_data.reindex_indexer(
   4884                 index,
   4885                 indexer,

~/.pyenv/versions/3.8.6/envs/pyenv3.8.6/lib/python3.8/site-packages/pandas/core/internals/managers.py in reindex_indexer(self, new_axis, indexer, axis, fill_value, allow_dups, copy, consolidate, only_slice)
    668         # some axes don't allow reindexing with dups
    669         if not allow_dups:
--&gt; 670             self.axes[axis]._validate_can_reindex(indexer)
    671 
    672         if axis &gt;= self.ndim:

~/.pyenv/versions/3.8.6/envs/pyenv3.8.6/lib/python3.8/site-packages/pandas/core/indexes/base.py in _validate_can_reindex(self, indexer)
   3783         # trying to reindex on an axis with duplicates
   3784         if not self._index_as_unique and len(indexer):
-&gt; 3785             raise ValueError(&quot;cannot reindex from a duplicate axis&quot;)
   3786 
   3787     def reindex(

ValueError: cannot reindex from a duplicate axis"><pre class="notranslate"><code class="notranslate">---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
&lt;ipython-input-3-e7c80e367597&gt; in &lt;module&gt;
     16 
     17 ax = plt.figure().gca()
---&gt; 18 sns.histplot(ax=ax, data=data, bins=10, x='bin', weights='value', hue='group')

~/.pyenv/versions/3.8.6/envs/pyenv3.8.6/lib/python3.8/site-packages/seaborn/distributions.py in histplot(data, x, y, hue, weights, stat, bins, binwidth, binrange, discrete, cumulative, common_bins, common_norm, multiple, element, fill, shrink, kde, kde_kws, line_kws, thresh, pthresh, pmax, cbar, cbar_ax, cbar_kws, palette, hue_order, hue_norm, color, log_scale, legend, ax, **kwargs)
   1460     if p.univariate:
   1461 
-&gt; 1462         p.plot_univariate_histogram(
   1463             multiple=multiple,
   1464             element=element,

~/.pyenv/versions/3.8.6/envs/pyenv3.8.6/lib/python3.8/site-packages/seaborn/distributions.py in plot_univariate_histogram(self, multiple, element, fill, common_norm, common_bins, shrink, kde, kde_kws, color, legend, line_kws, estimate_kws, **plot_kws)
    398         if set(self.variables) - {"x", "y"}:
    399 
--&gt; 400             all_data = self.comp_data.dropna()
    401 
    402             if common_bins:

~/.pyenv/versions/3.8.6/envs/pyenv3.8.6/lib/python3.8/site-packages/seaborn/_core.py in comp_data(self)
   1055                     orig = self.plot_data[var].dropna()
   1056                 comp_col = pd.Series(index=orig.index, dtype=float, name=var)
-&gt; 1057                 comp_col.loc[orig.index] = pd.to_numeric(axis.convert_units(orig))
   1058 
   1059                 if axis.get_scale() == "log":

~/.pyenv/versions/3.8.6/envs/pyenv3.8.6/lib/python3.8/site-packages/pandas/core/indexing.py in __setitem__(self, key, value)
    721 
    722         iloc = self if self.name == "iloc" else self.obj.iloc
--&gt; 723         iloc._setitem_with_indexer(indexer, value, self.name)
    724 
    725     def _validate_key(self, key, axis: int):

~/.pyenv/versions/3.8.6/envs/pyenv3.8.6/lib/python3.8/site-packages/pandas/core/indexing.py in _setitem_with_indexer(self, indexer, value, name)
   1730             self._setitem_with_indexer_split_path(indexer, value, name)
   1731         else:
-&gt; 1732             self._setitem_single_block(indexer, value, name)
   1733 
   1734     def _setitem_with_indexer_split_path(self, indexer, value, name: str):

~/.pyenv/versions/3.8.6/envs/pyenv3.8.6/lib/python3.8/site-packages/pandas/core/indexing.py in _setitem_single_block(self, indexer, value, name)
   1957             # setting for extensionarrays that store dicts. Need to decide
   1958             # if it's worth supporting that.
-&gt; 1959             value = self._align_series(indexer, Series(value))
   1960 
   1961         elif isinstance(value, ABCDataFrame) and name != "iloc":

~/.pyenv/versions/3.8.6/envs/pyenv3.8.6/lib/python3.8/site-packages/pandas/core/indexing.py in _align_series(self, indexer, ser, multiindex_indexer)
   2094             # series, so need to broadcast (see GH5206)
   2095             if sum_aligners == self.ndim and all(is_sequence(_) for _ in indexer):
-&gt; 2096                 ser = ser.reindex(obj.axes[0][indexer[0]], copy=True)._values
   2097 
   2098                 # single indexer

~/.pyenv/versions/3.8.6/envs/pyenv3.8.6/lib/python3.8/site-packages/pandas/core/series.py in reindex(self, index, **kwargs)
   4578     )
   4579     def reindex(self, index=None, **kwargs):
-&gt; 4580         return super().reindex(index=index, **kwargs)
   4581 
   4582     @deprecate_nonkeyword_arguments(version=None, allowed_args=["self", "labels"])

~/.pyenv/versions/3.8.6/envs/pyenv3.8.6/lib/python3.8/site-packages/pandas/core/generic.py in reindex(self, *args, **kwargs)
   4816 
   4817         # perform the reindex on the axes
-&gt; 4818         return self._reindex_axes(
   4819             axes, level, limit, tolerance, method, fill_value, copy
   4820         ).__finalize__(self, method="reindex")

~/.pyenv/versions/3.8.6/envs/pyenv3.8.6/lib/python3.8/site-packages/pandas/core/generic.py in _reindex_axes(self, axes, level, limit, tolerance, method, fill_value, copy)
   4837 
   4838             axis = self._get_axis_number(a)
-&gt; 4839             obj = obj._reindex_with_indexers(
   4840                 {axis: [new_index, indexer]},
   4841                 fill_value=fill_value,

~/.pyenv/versions/3.8.6/envs/pyenv3.8.6/lib/python3.8/site-packages/pandas/core/generic.py in _reindex_with_indexers(self, reindexers, fill_value, copy, allow_dups)
   4881 
   4882             # TODO: speed up on homogeneous DataFrame objects
-&gt; 4883             new_data = new_data.reindex_indexer(
   4884                 index,
   4885                 indexer,

~/.pyenv/versions/3.8.6/envs/pyenv3.8.6/lib/python3.8/site-packages/pandas/core/internals/managers.py in reindex_indexer(self, new_axis, indexer, axis, fill_value, allow_dups, copy, consolidate, only_slice)
    668         # some axes don't allow reindexing with dups
    669         if not allow_dups:
--&gt; 670             self.axes[axis]._validate_can_reindex(indexer)
    671 
    672         if axis &gt;= self.ndim:

~/.pyenv/versions/3.8.6/envs/pyenv3.8.6/lib/python3.8/site-packages/pandas/core/indexes/base.py in _validate_can_reindex(self, indexer)
   3783         # trying to reindex on an axis with duplicates
   3784         if not self._index_as_unique and len(indexer):
-&gt; 3785             raise ValueError("cannot reindex from a duplicate axis")
   3786 
   3787     def reindex(

ValueError: cannot reindex from a duplicate axis
</code></pre></div>
<p dir="auto">Now, I can work around this. By adding a <code class="notranslate">.reset_index()</code> call after I do a <code class="notranslate">pd.concat</code> on the data frames of the groups, that removes the duplicate indexes, and then seaborn is perfectly happy to make my plot.</p>
<p dir="auto">However, I'm not sure if the maintainers of this library are aware of this breakage or think that this is desirable behavior or not.</p>
<p dir="auto">See <a href="https://discourse.matplotlib.org/t/public-api-for-resolving-artist-property-aliases/21230" rel="nofollow">https://discourse.matplotlib.org/t/public-api-for-resolving-artist-property-aliases/21230</a></p>
<p dir="auto">This is done in an ad hoc way in various <code class="notranslate">.plot</code> methods but it would be good to avoid duplicating code.</p>