title: How to sort a heatmap to show highest correlations together?
body: <p>I'm trying to create a heatmap to show relationships between how many times Customers use reports, using the Count column as the values within the Heatmap Customers can use several templates as many times as they want. My dataframe looks something like this (Original data frame has 638 rows and I have created dummy data to conceal the original data for privacy purposes):</p>
  <pre><code>print(df)
  
       Customer     Report         Count
  1    XIAA         Report_A       198
  2    XIAA         Report_C       1
  3    BKAN         Bespoke        65
  4    JAJS         Report_A       3
  5    HNUA         Report_F       436
  6    NOAO         Bespoke        12
  7    RQNJ         Report_G       53
  8    MJAS         Report_A       9
  9    PGBC         Report_Y       155
  </code></pre>
  <p>To plot a heatmap, I'm using the function:</p>
  <pre><code>heatmap1_data = pd.pivot_table(df, values='Count', 
                       index=['Customer'], 
                       columns='Report')
  plt.subplots(figsize=(25, 30))
  sns.heatmap(heatmap1_data, cmap=&quot;Blues&quot;,vmin=0, vmax=2)
  </code></pre>
  <p>My heatmap is returned like this (I have cropped the names in the axis for privacy purposes):
  <a href="https://i.stack.imgur.com/4pAMR.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4pAMR.jpg" alt="enter image description here" /></a></p>
  <p>The heatmap looks too separated due to the variation of the counts in my dataframe, which causes the Pivot table to have many '0' values to show which Reports are not being used by certain customers. Is there a way to sort this so that the highest correlations are shown together within the heatmap instead of them being very seperated?</p>