<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/32168189/205221286-8660398c-9e9e-434e-97f0-7266b7969d31.png"><img src="https://user-images.githubusercontent.com/32168189/205221286-8660398c-9e9e-434e-97f0-7266b7969d31.png" alt="image" style="max-width: 100%;"></a></p>
<p dir="auto">It seems that the histogram legend appears twice. I expected it to show only once. Did I miss something?</p>
<p dir="auto">I'm running this code from <a href="https://seaborn.pydata.org/examples/structured_heatmap.html" rel="nofollow">Discovering structure in heatmap data</a> example in the gallery.</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="%pylab inline

import pandas as pd
import seaborn as sns
sns.set()

# Load the brain networks example dataset
df = sns.load_dataset(&quot;brain_networks&quot;, header=[0, 1, 2], index_col=0)

# Select a subset of the networks
used_networks = [1, 5, 6, 7, 8, 12, 13, 17]
used_columns = (df.columns.get_level_values(&quot;network&quot;)
                          .astype(int)
                          .isin(used_networks))
df = df.loc[:, used_columns]

# Create a categorical palette to identify the networks
network_pal = sns.husl_palette(8, s=.45)
network_lut = dict(zip(map(str, used_networks), network_pal))

# Convert the palette to vectors that will be drawn on the side of the matrix
networks = df.columns.get_level_values(&quot;network&quot;)
network_colors = pd.Series(networks, index=df.columns).map(network_lut)

# Draw the full plot
sns.clustermap(df.corr(), center=0, cmap=&quot;vlag&quot;,
               row_colors=network_colors, col_colors=network_colors,
               linewidths=.75, figsize=(13, 13))"><pre class="notranslate"><span class="pl-c1">%</span><span class="pl-s1">pylab</span> <span class="pl-s1">inline</span>

<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-c"># Load the brain networks example dataset</span>
<span class="pl-s1">df</span> <span class="pl-c1">=</span> <span class="pl-s1">sns</span>.<span class="pl-en">load_dataset</span>(<span class="pl-s">"brain_networks"</span>, <span class="pl-s1">header</span><span class="pl-c1">=</span>[<span class="pl-c1">0</span>, <span class="pl-c1">1</span>, <span class="pl-c1">2</span>], <span class="pl-s1">index_col</span><span class="pl-c1">=</span><span class="pl-c1">0</span>)

<span class="pl-c"># Select a subset of the networks</span>
<span class="pl-s1">used_networks</span> <span class="pl-c1">=</span> [<span class="pl-c1">1</span>, <span class="pl-c1">5</span>, <span class="pl-c1">6</span>, <span class="pl-c1">7</span>, <span class="pl-c1">8</span>, <span class="pl-c1">12</span>, <span class="pl-c1">13</span>, <span class="pl-c1">17</span>]
<span class="pl-s1">used_columns</span> <span class="pl-c1">=</span> (<span class="pl-s1">df</span>.<span class="pl-s1">columns</span>.<span class="pl-en">get_level_values</span>(<span class="pl-s">"network"</span>)
                          .<span class="pl-en">astype</span>(<span class="pl-s1">int</span>)
                          .<span class="pl-en">isin</span>(<span class="pl-s1">used_networks</span>))
<span class="pl-s1">df</span> <span class="pl-c1">=</span> <span class="pl-s1">df</span>.<span class="pl-s1">loc</span>[:, <span class="pl-s1">used_columns</span>]

<span class="pl-c"># Create a categorical palette to identify the networks</span>
<span class="pl-s1">network_pal</span> <span class="pl-c1">=</span> <span class="pl-s1">sns</span>.<span class="pl-en">husl_palette</span>(<span class="pl-c1">8</span>, <span class="pl-s1">s</span><span class="pl-c1">=</span><span class="pl-c1">.45</span>)
<span class="pl-s1">network_lut</span> <span class="pl-c1">=</span> <span class="pl-en">dict</span>(<span class="pl-en">zip</span>(<span class="pl-en">map</span>(<span class="pl-s1">str</span>, <span class="pl-s1">used_networks</span>), <span class="pl-s1">network_pal</span>))

<span class="pl-c"># Convert the palette to vectors that will be drawn on the side of the matrix</span>
<span class="pl-s1">networks</span> <span class="pl-c1">=</span> <span class="pl-s1">df</span>.<span class="pl-s1">columns</span>.<span class="pl-en">get_level_values</span>(<span class="pl-s">"network"</span>)
<span class="pl-s1">network_colors</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-v">Series</span>(<span class="pl-s1">networks</span>, <span class="pl-s1">index</span><span class="pl-c1">=</span><span class="pl-s1">df</span>.<span class="pl-s1">columns</span>).<span class="pl-en">map</span>(<span class="pl-s1">network_lut</span>)

<span class="pl-c"># Draw the full plot</span>
<span class="pl-s1">sns</span>.<span class="pl-en">clustermap</span>(<span class="pl-s1">df</span>.<span class="pl-en">corr</span>(), <span class="pl-s1">center</span><span class="pl-c1">=</span><span class="pl-c1">0</span>, <span class="pl-s1">cmap</span><span class="pl-c1">=</span><span class="pl-s">"vlag"</span>,
               <span class="pl-s1">row_colors</span><span class="pl-c1">=</span><span class="pl-s1">network_colors</span>, <span class="pl-s1">col_colors</span><span class="pl-c1">=</span><span class="pl-s1">network_colors</span>,
               <span class="pl-s1">linewidths</span><span class="pl-c1">=</span><span class="pl-c1">.75</span>, <span class="pl-s1">figsize</span><span class="pl-c1">=</span>(<span class="pl-c1">13</span>, <span class="pl-c1">13</span>))</pre></div>
<p dir="auto">When I run it, the top and bottom rows are truncated by half causing all of the rows to slightly misalign with the dendrograms.</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/8236564/61407939-c2995b80-a893-11e9-9b05-6052333f857a.png"><img src="https://user-images.githubusercontent.com/8236564/61407939-c2995b80-a893-11e9-9b05-6052333f857a.png" alt="image" style="max-width: 100%;"></a></p>
<p dir="auto">This is with the latest release <code class="notranslate">0.9.0</code> and matplotlib version <code class="notranslate">3.1.1</code>.</p>