<p dir="auto">Hello,</p>
<p dir="auto">I had reopened an old closed issue. I think it might be wiser to create a new one.</p>
<p dir="auto">I have been trying to understand why the <code class="notranslate">colors_ratio</code>  parameter of the <code class="notranslate">clustermap</code> was never working for me.</p>
<p dir="auto">I am running python3.8, with seaborn0.10.1 and my call is the following:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="sns.clustermap(np.log2(1.01+merged[merged.columns[8:-12]].loc[rand].T),col_cluster=False, standard_scale=0, colors_ratio=0.7, col_colors = data, figsize=(30,20), xticklabels=False)
fig.ax_col_dendrogram.set_visible(False)"><pre class="notranslate"><span class="pl-s1">sns</span>.<span class="pl-en">clustermap</span>(<span class="pl-s1">np</span>.<span class="pl-en">log2</span>(<span class="pl-c1">1.01</span><span class="pl-c1">+</span><span class="pl-s1">merged</span>[<span class="pl-s1">merged</span>.<span class="pl-s1">columns</span>[<span class="pl-c1">8</span>:<span class="pl-c1">-</span><span class="pl-c1">12</span>]].<span class="pl-s1">loc</span>[<span class="pl-s1">rand</span>].<span class="pl-v">T</span>),<span class="pl-s1">col_cluster</span><span class="pl-c1">=</span><span class="pl-c1">False</span>, <span class="pl-s1">standard_scale</span><span class="pl-c1">=</span><span class="pl-c1">0</span>, <span class="pl-s1">colors_ratio</span><span class="pl-c1">=</span><span class="pl-c1">0.7</span>, <span class="pl-s1">col_colors</span> <span class="pl-c1">=</span> <span class="pl-s1">data</span>, <span class="pl-s1">figsize</span><span class="pl-c1">=</span>(<span class="pl-c1">30</span>,<span class="pl-c1">20</span>), <span class="pl-s1">xticklabels</span><span class="pl-c1">=</span><span class="pl-c1">False</span>)
<span class="pl-s1">fig</span>.<span class="pl-s1">ax_col_dendrogram</span>.<span class="pl-en">set_visible</span>(<span class="pl-c1">False</span>)</pre></div>
<p dir="auto">but I have been trying without all possible parameters and array sizes and I was never able to make this parameter work (except is set at 0). I always seem to get the same error:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="ValueError: Width and height specified must be non-negative:"><pre class="notranslate"><span class="pl-v">ValueError</span>: <span class="pl-v">Width</span> <span class="pl-c1">and</span> <span class="pl-s1">height</span> <span class="pl-s1">specified</span> <span class="pl-s1">must</span> <span class="pl-s1">be</span> <span class="pl-s1">non</span><span class="pl-c1">-</span><span class="pl-s1">negative</span>:</pre></div>
<p dir="auto">with the following stacktrace:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="~/.local/lib/python3.8/site-packages/seaborn/matrix.py in clustermap(data, pivot_kws, method, metric, z_score, standard_scale, figsize, cbar_kws, row_cluster, col_cluster, row_linkage, col_linkage, row_colors, col_colors, mask, dendrogram_ratio, colors_ratio, cbar_pos, tree_kws, **kwargs)
   1379 
   1380     &quot;&quot;&quot;
-&gt; 1381     plotter = ClusterGrid(data, pivot_kws=pivot_kws, figsize=figsize,
   1382                           row_colors=row_colors, col_colors=col_colors,
   1383                           z_score=z_score, standard_scale=standard_scale,

~/.local/lib/python3.8/site-packages/seaborn/matrix.py in __init__(self, data, pivot_kws, z_score, standard_scale, figsize, row_colors, col_colors, mask, dendrogram_ratio, colors_ratio, cbar_pos)
    825                                     height_ratios=height_ratios)
    826 
--&gt; 827         self.ax_row_dendrogram = self.fig.add_subplot(self.gs[-1, 0])
    828         self.ax_col_dendrogram = self.fig.add_subplot(self.gs[0, -1])
    829         self.ax_row_dendrogram.set_axis_off()

~/.local/lib/python3.8/site-packages/matplotlib/figure.py in add_subplot(self, *args, **kwargs)
   1417                     self._axstack.remove(ax)
   1418 
-&gt; 1419             a = subplot_class_factory(projection_class)(self, *args, **kwargs)
   1420 
   1421         return self._add_axes_internal(key, a)

~/.local/lib/python3.8/site-packages/matplotlib/axes/_subplots.py in __init__(self, fig, *args, **kwargs)
     74 
     75         # _axes_class is set in the subplot_class_factory
---&gt; 76         self._axes_class.__init__(self, fig, self.figbox, **kwargs)
     77         # add a layout box to this, for both the full axis, and the poss
     78         # of the axis.  We need both because the axes may become smaller

~/.local/lib/python3.8/site-packages/matplotlib/axes/_base.py in __init__(self, fig, rect, facecolor, frameon, sharex, sharey, label, xscale, yscale, **kwargs)
    422             self._position = mtransforms.Bbox.from_bounds(*rect)
    423         if self._position.width &lt; 0 or self._position.height &lt; 0:
--&gt; 424             raise ValueError('Width and height specified must be non-negative')
    425         self._originalPosition = self._position.frozen()
    426         self.axes = self

ValueError: Width and height specified must be non-negative "><pre class="notranslate"><span class="pl-c1">~</span><span class="pl-c1">/</span>.<span class="pl-s1">local</span><span class="pl-c1">/</span><span class="pl-s1">lib</span><span class="pl-c1">/</span><span class="pl-s1">python3</span>.<span class="pl-c1">8</span><span class="pl-c1">/</span><span class="pl-s1">site</span><span class="pl-c1">-</span><span class="pl-s1">packages</span><span class="pl-c1">/</span><span class="pl-s1">seaborn</span><span class="pl-c1">/</span><span class="pl-s1">matrix</span>.<span class="pl-s1">py</span> <span class="pl-c1">in</span> <span class="pl-en">clustermap</span>(<span class="pl-s1">data</span>, <span class="pl-s1">pivot_kws</span>, <span class="pl-s1">method</span>, <span class="pl-s1">metric</span>, <span class="pl-s1">z_score</span>, <span class="pl-s1">standard_scale</span>, <span class="pl-s1">figsize</span>, <span class="pl-s1">cbar_kws</span>, <span class="pl-s1">row_cluster</span>, <span class="pl-s1">col_cluster</span>, <span class="pl-s1">row_linkage</span>, <span class="pl-s1">col_linkage</span>, <span class="pl-s1">row_colors</span>, <span class="pl-s1">col_colors</span>, <span class="pl-s1">mask</span>, <span class="pl-s1">dendrogram_ratio</span>, <span class="pl-s1">colors_ratio</span>, <span class="pl-s1">cbar_pos</span>, <span class="pl-s1">tree_kws</span>, <span class="pl-c1">**</span><span class="pl-s1">kwargs</span>)
   <span class="pl-c1">1379</span> 
   <span class="pl-c1">1380</span>     """
<span class="pl-c1">-&gt;</span> <span class="pl-c1">1381</span>     <span class="pl-s1">plotter</span> <span class="pl-c1">=</span> <span class="pl-v">ClusterGrid</span>(<span class="pl-s1">data</span>, <span class="pl-s1">pivot_kws</span><span class="pl-c1">=</span><span class="pl-s1">pivot_kws</span>, <span class="pl-s1">figsize</span><span class="pl-c1">=</span><span class="pl-s1">figsize</span>,
   <span class="pl-c1">1382</span>                           <span class="pl-s1">row_colors</span><span class="pl-c1">=</span><span class="pl-s1">row_colors</span>, <span class="pl-s1">col_colors</span><span class="pl-c1">=</span><span class="pl-s1">col_colors</span>,
   <span class="pl-c1">1383</span>                           <span class="pl-s1">z_score</span><span class="pl-c1">=</span><span class="pl-s1">z_score</span>, <span class="pl-s1">standard_scale</span><span class="pl-c1">=</span><span class="pl-s1">standard_scale</span>,

<span class="pl-c1">~</span><span class="pl-c1">/</span>.<span class="pl-s1">local</span><span class="pl-c1">/</span><span class="pl-s1">lib</span><span class="pl-c1">/</span><span class="pl-s1">python3</span>.<span class="pl-c1">8</span><span class="pl-c1">/</span><span class="pl-s1">site</span><span class="pl-c1">-</span><span class="pl-s1">packages</span><span class="pl-c1">/</span><span class="pl-s1">seaborn</span><span class="pl-c1">/</span><span class="pl-s1">matrix</span>.<span class="pl-s1">py</span> <span class="pl-c1">in</span> <span class="pl-en">__init__</span>(<span class="pl-s1">self</span>, <span class="pl-s1">data</span>, <span class="pl-s1">pivot_kws</span>, <span class="pl-s1">z_score</span>, <span class="pl-s1">standard_scale</span>, <span class="pl-s1">figsize</span>, <span class="pl-s1">row_colors</span>, <span class="pl-s1">col_colors</span>, <span class="pl-s1">mask</span>, <span class="pl-s1">dendrogram_ratio</span>, <span class="pl-s1">colors_ratio</span>, <span class="pl-s1">cbar_pos</span>)
    <span class="pl-c1">825</span>                                     <span class="pl-s1">height_ratios</span><span class="pl-c1">=</span><span class="pl-s1">height_ratios</span>)
    <span class="pl-c1">826</span> 
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">827</span>         <span class="pl-s1">self</span>.<span class="pl-s1">ax_row_dendrogram</span> <span class="pl-c1">=</span> <span class="pl-s1">self</span>.<span class="pl-s1">fig</span>.<span class="pl-en">add_subplot</span>(<span class="pl-s1">self</span>.<span class="pl-s1">gs</span>[<span class="pl-c1">-</span><span class="pl-c1">1</span>, <span class="pl-c1">0</span>])
    <span class="pl-c1">828</span>         <span class="pl-s1">self</span>.<span class="pl-s1">ax_col_dendrogram</span> <span class="pl-c1">=</span> <span class="pl-s1">self</span>.<span class="pl-s1">fig</span>.<span class="pl-en">add_subplot</span>(<span class="pl-s1">self</span>.<span class="pl-s1">gs</span>[<span class="pl-c1">0</span>, <span class="pl-c1">-</span><span class="pl-c1">1</span>])
    <span class="pl-c1">829</span>         <span class="pl-s1">self</span>.<span class="pl-s1">ax_row_dendrogram</span>.<span class="pl-en">set_axis_off</span>()

<span class="pl-c1">~</span><span class="pl-c1">/</span>.<span class="pl-s1">local</span><span class="pl-c1">/</span><span class="pl-s1">lib</span><span class="pl-c1">/</span><span class="pl-s1">python3</span>.<span class="pl-c1">8</span><span class="pl-c1">/</span><span class="pl-s1">site</span><span class="pl-c1">-</span><span class="pl-s1">packages</span><span class="pl-c1">/</span><span class="pl-s1">matplotlib</span><span class="pl-c1">/</span><span class="pl-s1">figure</span>.<span class="pl-s1">py</span> <span class="pl-c1">in</span> <span class="pl-en">add_subplot</span>(<span class="pl-s1">self</span>, <span class="pl-c1">*</span><span class="pl-s1">args</span>, <span class="pl-c1">**</span><span class="pl-s1">kwargs</span>)
   <span class="pl-c1">1417</span>                     <span class="pl-s1">self</span>.<span class="pl-s1">_axstack</span>.<span class="pl-en">remove</span>(<span class="pl-s1">ax</span>)
   <span class="pl-c1">1418</span> 
<span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">1419</span>             <span class="pl-s1">a</span> <span class="pl-c1">=</span> <span class="pl-en">subplot_class_factory</span>(<span class="pl-s1">projection_class</span>)(<span class="pl-s1">self</span>, <span class="pl-c1">*</span><span class="pl-s1">args</span>, <span class="pl-c1">**</span><span class="pl-s1">kwargs</span>)
   <span class="pl-c1">1420</span> 
   <span class="pl-c1">1421</span>         <span class="pl-k">return</span> <span class="pl-s1">self</span>.<span class="pl-en">_add_axes_internal</span>(<span class="pl-s1">key</span>, <span class="pl-s1">a</span>)

<span class="pl-c1">~</span><span class="pl-c1">/</span>.<span class="pl-s1">local</span><span class="pl-c1">/</span><span class="pl-s1">lib</span><span class="pl-c1">/</span><span class="pl-s1">python3</span>.<span class="pl-c1">8</span><span class="pl-c1">/</span><span class="pl-s1">site</span><span class="pl-c1">-</span><span class="pl-s1">packages</span><span class="pl-c1">/</span><span class="pl-s1">matplotlib</span><span class="pl-c1">/</span><span class="pl-s1">axes</span><span class="pl-c1">/</span><span class="pl-s1">_subplots</span>.<span class="pl-s1">py</span> <span class="pl-c1">in</span> <span class="pl-en">__init__</span>(<span class="pl-s1">self</span>, <span class="pl-s1">fig</span>, <span class="pl-c1">*</span><span class="pl-s1">args</span>, <span class="pl-c1">**</span><span class="pl-s1">kwargs</span>)
     <span class="pl-c1">74</span> 
     <span class="pl-c1">75</span>         <span class="pl-c"># _axes_class is set in the subplot_class_factory</span>
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">76</span>         <span class="pl-s1">self</span>.<span class="pl-s1">_axes_class</span>.<span class="pl-en">__init__</span>(<span class="pl-s1">self</span>, <span class="pl-s1">fig</span>, <span class="pl-s1">self</span>.<span class="pl-s1">figbox</span>, <span class="pl-c1">**</span><span class="pl-s1">kwargs</span>)
     <span class="pl-c1">77</span>         <span class="pl-c"># add a layout box to this, for both the full axis, and the poss</span>
     <span class="pl-c1">78</span>         <span class="pl-c"># of the axis.  We need both because the axes may become smaller</span>

<span class="pl-c1">~</span><span class="pl-c1">/</span>.<span class="pl-s1">local</span><span class="pl-c1">/</span><span class="pl-s1">lib</span><span class="pl-c1">/</span><span class="pl-s1">python3</span>.<span class="pl-c1">8</span><span class="pl-c1">/</span><span class="pl-s1">site</span><span class="pl-c1">-</span><span class="pl-s1">packages</span><span class="pl-c1">/</span><span class="pl-s1">matplotlib</span><span class="pl-c1">/</span><span class="pl-s1">axes</span><span class="pl-c1">/</span><span class="pl-s1">_base</span>.<span class="pl-s1">py</span> <span class="pl-c1">in</span> <span class="pl-en">__init__</span>(<span class="pl-s1">self</span>, <span class="pl-s1">fig</span>, <span class="pl-s1">rect</span>, <span class="pl-s1">facecolor</span>, <span class="pl-s1">frameon</span>, <span class="pl-s1">sharex</span>, <span class="pl-s1">sharey</span>, <span class="pl-s1">label</span>, <span class="pl-s1">xscale</span>, <span class="pl-s1">yscale</span>, <span class="pl-c1">**</span><span class="pl-s1">kwargs</span>)
    <span class="pl-c1">422</span>             <span class="pl-s1">self</span>.<span class="pl-s1">_position</span> <span class="pl-c1">=</span> <span class="pl-s1">mtransforms</span>.<span class="pl-v">Bbox</span>.<span class="pl-en">from_bounds</span>(<span class="pl-c1">*</span><span class="pl-s1">rect</span>)
    <span class="pl-c1">423</span>         <span class="pl-k">if</span> <span class="pl-s1">self</span>.<span class="pl-s1">_position</span>.<span class="pl-s1">width</span> <span class="pl-c1">&lt;</span> <span class="pl-c1">0</span> <span class="pl-c1">or</span> <span class="pl-s1">self</span>.<span class="pl-s1">_position</span>.<span class="pl-s1">height</span> <span class="pl-c1">&lt;</span> <span class="pl-c1">0</span>:
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">424</span>             <span class="pl-s1">raise</span> <span class="pl-v">ValueError</span>(<span class="pl-s">'Width and height specified must be non-negative'</span>)
    <span class="pl-c1">425</span>         <span class="pl-s1">self</span>.<span class="pl-s1">_originalPosition</span> <span class="pl-c1">=</span> <span class="pl-s1">self</span>.<span class="pl-s1">_position</span>.<span class="pl-en">frozen</span>()
    <span class="pl-c1">426</span>         <span class="pl-s1">self</span>.<span class="pl-s1">axes</span> <span class="pl-c1">=</span> <span class="pl-s1">self</span>

<span class="pl-v">ValueError</span>: <span class="pl-v">Width</span> <span class="pl-c1">and</span> <span class="pl-s1">height</span> <span class="pl-s1">specified</span> <span class="pl-s1">must</span> <span class="pl-s1">be</span> <span class="pl-s1">non</span><span class="pl-c1">-</span><span class="pl-s1">negative</span> </pre></div>
<p dir="auto">Would you be able to help me on this?</p>
<p dir="auto">Thanks for having implemented this feature in the first place,</p>
<p dir="auto">Best,</p>
<p dir="auto">I have a custom legend and colors aren't matching well.<br>
Is there a workaround? Is this intended?</p>