title: How to change the values of the colorbar without changing the heatmap in python matplotlib?
body: <p>I have a heatmap fuse to a scatterplot and I want to change the value of the colorbar ticks. The colorbar take heatmap value(0 to 1100) but I want to have a colorbar with temperature values(6,33). How can I do that without changing the apparence of the heatmap. I try to use <code>clim</code>but it change the apparence of the heatmap. Here's the code:</p>
  
  <pre class="lang-py prettyprint-override"><code>import pandas as pd
  import matplotlib.pyplot as plt
  import numpy as np
  
  df = pd.read_csv("data/forestfires.csv")
  
  x_number_list = df.X.tolist()
  y_number_list = df.Y.tolist()
  x_number_list = np.array(x_number_list)
  y_number_list = np.array(y_number_list)
  
  area_number_list = df.area.tolist()
  area_number_list = [int(round(x+1,0)) for x in area_number_list]
  temperature_number_list = df.temp.tolist()
  temperature_number_list = np.array(temperature_number_list)
  
  heatmap, xedges, yedges = np.histogram2d(y_number_list, x_number_list, weights=temperature_number_list)
  fig, ax1 = plt.subplots(figsize=(7,7))
  im = ax1.imshow(heatmap, interpolation='bicubic', cmap='hot', origin='lower') #bicubic
  ax1.scatter(x_number_list, y_number_list, s=area_number_list, color=(157/255, 173/255, 245/255, 0.9))
  ax1.set_ylim(y_number_list.min()-0.5, y_number_list.max()+0.5)
  ax1.set_xlim(x_number_list.min()-0.5, x_number_list.max()+0.5)
  
  cb = plt.colorbar(im, ax=ax1, shrink=0.73)
  #im.set_clim(temperature_number_list.min(), temperature_number_list.max())
  
  plt.show()
  </code></pre>
  
  <p>and here's the result:</p>
  
  <p><a href="https://i.stack.imgur.com/pxyLN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pxyLN.png" alt="enter image description here"></a></p>
  
  <p>When I use clim, <code>im.set_clim(temperature_number_list.min(), temperature_number_list.max())</code> I get this result(it's a result that I <strong>DON'T</strong> want):</p>
  
  <p><a href="https://i.stack.imgur.com/jm64M.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jm64M.png" alt="enter image description here"></a></p>