title: Custom color palette intervals in seaborn heatmap
body: <p>I am trying to plot a <a href="https://seaborn.pydata.org/generated/seaborn.heatmap.html" rel="nofollow noreferrer">heatmap</a> using seaborn library.</p>
  
  <p>The plotting function looks like this:</p>
  
  <pre><code>def plot_confusion_matrix(data, labels, **kwargs):
      """Visualize confusion matrix as a heat map."""
      col_map = kwargs.get('color_palette', sns.light_palette('navy', n_colors=5, as_cmap=False))
  
      sns.heatmap(
          vmin=0.0,
          vmax=1.0,
          data=data,
          cmap=col_map,
          xticklabels=labels,
          yticklabels=labels,
          linewidths=0.75,
      )
  </code></pre>
  
  <p>The histogram of the <code>data</code>, however, looks like this:
  <a href="https://i.stack.imgur.com/DCGSC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DCGSC.png" alt="Histogram"></a></p>
  
  <p>Now the issue I am struggling with is that seaborn heatmap(view bellow) splits evenly the color scale and hence most of the data has the same color (since the data is not evenly distributed).</p>
  
  <p>I was not able to find out how to set some sort of intervals or boundaries for the color levels.</p>
  
  <p>Suppose I have the following array of hex color values:</p>
  
  <p><code>['#e5e5ff', '#acacdf', '#7272bf', '#39399f', '#000080']</code></p>
  
  <p>Is there a way to set up a color such as</p>
  
  <p><code>[(threshold_0, hex_0), (threshold_1, hex_1), ..., (threshold_n, hex_n)]</code></p>
  
  <p>where <code>threshold_i</code> is a value in range [0, 1)</p>
  
  <p><br>
  Appreciate any help.</p>
  
  <p>PS: current heatmap for illustration:</p>
  
  <p><a href="https://i.stack.imgur.com/hOqBF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hOqBF.png" alt="enter image description here"></a></p>