title: SNS heatmap shows wrong colors for % values when none of the values are 100. Colorbar range is not 0 to 100%, instead range is btw min and max values
body: <p>Using seaborn in Python to create a heatmap, how can I have the colorbar show ALWAYS a 0 to 100% range and not the range of the maximum and minimum values of the dataframe. If the code below is executed the value of 50 (the max value), which should be yellow since it represents 50%, appears as dark red, indicating the maximum value in the colorbar. However, if we add a dummy value equal to 100 and execute the code again, then the colors of the rest of the values appear as they should, including the 50 value, which now is yellow as we expect. I am not sure how to specify this and haven't found the answer online. Any help would be quite helpful.</p>
  <p>How it looks now:</p>
  <p><a href="https://i.stack.imgur.com/y56Qg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/y56Qg.png" alt="enter image description here" /></a></p>
  <p>How the colors should look using an additional dummy value equal to 100 to show correct colors:
  <a href="https://i.stack.imgur.com/dkyms.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dkyms.png" alt="enter image description here" /></a></p>
  <pre><code>import seaborn as sns
  # Creating the dataframe for Main Node 1
  # We define the name of the columns and index
  index_node_1 = [&quot;Node 1&quot;, &quot;Node 3&quot;, &quot;Node 4&quot;, &quot;Node 64&quot;]
  #columns = [&quot;main_node&quot;, &quot;standard_node&quot;, &quot;type_17&quot;, &quot;type_45&quot;, &quot;type_20&quot;, &quot;type_23&quot;, &quot;type_25&quot;, &quot;type_38&quot;, &quot;type_39&quot;]
  columns = [&quot;main_node&quot;, &quot;standard_node&quot;, &quot;type_17&quot;, &quot;type_45&quot;, &quot;type_20 (A)&quot;, &quot;type_20 (B)&quot;, &quot;type_23 (A)&quot;, &quot;type_23 (B)&quot;, &quot;type_25 (A)&quot;, &quot;type_25 (B)&quot;, &quot;type_38 (A)&quot;, &quot;type_38 (B)&quot;, &quot;type_39 (A)&quot;, &quot;type_39 (B)&quot;]
  
  # We generate the dataframe for specified node
  df_hm_node_1 = pd.DataFrame(
  {
  columns[0]:[10, None, None, None],
  columns[1]:[None, 20,  30, 50],
  columns[2]: np.NAN, # REMOVE COMMENT IF ANY VALUE IN THIS COLUMN IS EQUAL OR GREATER THAN ZERO AND INCLUDE NON-ZERO COLUMNS,
  columns[3]:[5,None,None,None],
  columns[4]: np.NAN, # REMOVE COMMENT IF ANY VALUE IN THIS COLUMN IS EQUAL OR GREATER THAN ZERO AND INCLUDE NON-ZERO COLUMNS 
  columns[5]: np.NAN, # REMOVE COMMENT IF ANY VALUE IN THIS COLUMN IS EQUAL OR GREATER THAN ZERO AND INCLUDE NON-ZERO COLUMNS
  columns[6]: np.NAN, # REMOVE COMMENT IF ANY VALUE IN THIS COLUMN IS EQUAL OR GREATER THAN ZERO AND INCLUDE NON-ZERO COLUMNS
  columns[7]: np.NAN, # REMOVE COMMENT IF ANY VALUE IN THIS COLUMN IS EQUAL OR GREATER THAN ZERO AND INCLUDE NON-ZERO COLUMNS
  columns[8]: np.NAN, # REMOVE COMMENT IF ANY VALUE IN THIS COLUMN IS EQUAL OR GREATER THAN ZERO AND INCLUDE NON-ZERO COLUMNS
  columns[9]: np.NAN, # REMOVE COMMENT IF ANY VALUE IN THIS COLUMN IS EQUAL OR GREATER THAN ZERO AND INCLUDE NON-ZERO COLUMNS
  columns[10]:np.NAN, # REMOVE COMMENT IF ANY VALUE IN THIS COLUMN IS EQUAL OR GREATER THAN ZERO AND INCLUDE NON-ZERO COLUMNS
  columns[11]:np.NAN, # REMOVE COMMENT IF ANY VALUE IN THIS COLUMN IS EQUAL OR GREATER THAN ZERO AND INCLUDE NON-ZERO COLUMNS
  columns[12]:np.NAN, # REMOVE COMMENT IF ANY VALUE IN THIS COLUMN IS EQUAL OR GREATER THAN ZERO AND INCLUDE NON-ZERO COLUMNS
  columns[13]:np.NAN  # REMOVE COMMENT IF ANY VALUE IN THIS COLUMN IS EQUAL OR GREATER THAN ZERO AND INCLUDE NON-ZERO COLUMNS
  }, 
  index = index_node_1)
  
  # We create the heatmap graph for the current node
  fig, ax = plt.subplots(figsize=(12,4))
  hm_node_1 = sns.heatmap(df_hm_node_1, cmap='RdYlGn_r', linewidths=1, cbar_kws={'format': '%.0f%%', 'ticks': [0, 100]}, fmt='g', annot=True)
  #hm_node_5.set_title(&quot;Main node 5&quot;)
  plt.title(&quot;Main node 1&quot;, fontsize=18)
  </code></pre>