title: Add 3 or more legends to a seaborn clustermap
body: <p><a href="https://stackoverflow.com/a/53217838/1379826">Using another answer</a>, I'm wondering if it is possible to add 3 or more legends? Adapting the code from the author, I could add 4 row labels, but adding the legend is tricky. If I add more <code>row_dendrogram</code> and <code>col_dendrogram</code>, they simply do not show independently from the others.</p>
  <pre><code>import seaborn as sns
  from matplotlib.pyplot import gcf
  
  networks = sns.load_dataset(&quot;brain_networks&quot;, index_col=0, header=[0, 1, 2])
  
  # Label 1
  network_labels = networks.columns.get_level_values(&quot;network&quot;)
  network_pal = sns.cubehelix_palette(network_labels.unique().size, light=.9, dark=.1, reverse=True, start=1, rot=-2)
  network_lut = dict(zip(map(str, network_labels.unique()), network_pal))
  network_colors = pd.Series(network_labels, index=networks.columns).map(network_lut)
  
  # Label 2
  node_labels = networks.columns.get_level_values(&quot;node&quot;)
  node_pal = sns.cubehelix_palette(node_labels.unique().size)
  node_lut = dict(zip(map(str, node_labels.unique()), node_pal))
  node_colors = pd.Series(node_labels, index=networks.columns).map(node_lut)
  
  # Label 3
  lab3_labels = networks.columns.get_level_values(&quot;node&quot;)
  lab3_pal = sns.color_palette(&quot;hls&quot;, lab3_labels.unique().size)
  lab3_lut = dict(zip(map(str, lab3_labels.unique()), lab3_pal))
  lab3_colors = pd.Series(lab3_labels, index=networks.columns, name='lab3').map(lab3_lut)
  
  # Label 4
  lab4_labels = networks.columns.get_level_values(&quot;node&quot;)
  lab4_pal = sns.color_palette(&quot;husl&quot;, lab4_labels.unique().size)
  lab4_lut = dict(zip(map(str, lab4_labels.unique()), lab4_pal))
  lab4_colors = pd.Series(lab4_labels, index=networks.columns, name='lab4').map(lab4_lut)
  
  network_node_colors = pd.DataFrame(network_colors).join(pd.DataFrame(node_colors)).join(pd.DataFrame(lab3_colors)).join(pd.DataFrame(lab4_colors))
  
  g = sns.clustermap(networks.corr(),
      row_cluster=False, col_cluster=False,
      row_colors = network_node_colors,
      col_colors = network_node_colors,
      linewidths=0,
      xticklabels=False, yticklabels=False,
      center=0, cmap=&quot;vlag&quot;)
  
  
  # add legends
  for label in network_labels.unique():
      g.ax_col_dendrogram.bar(0, 0, color=network_lut[label], label=label, linewidth=0);
  l1 = g.ax_col_dendrogram.legend(title='Network', loc=&quot;center&quot;, ncol=5, bbox_to_anchor=(0.47, 0.89), bbox_transform=gcf().transFigure)
  
  for label in node_labels.unique():
      g.ax_row_dendrogram.bar(0, 0, color=node_lut[label], label=label, linewidth=0);
  l2 = g.ax_row_dendrogram.legend(title='Node', loc=&quot;center&quot;, ncol=2, bbox_to_anchor=(0.8, 0.89), bbox_transform=gcf().transFigure)
  
  #how to add other row dendrograms here without them overlapping with the existing ones?
  plt.show()
  </code></pre>
  <p><a href="https://i.stack.imgur.com/DMP0k.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DMP0k.png" alt="enter image description here" /></a></p>