title: Plotting sorted heatmap keeping (x,y) value colors
body: <p>I've been working with python, pandas and seaborn to get a heatmap with different colormaps/columns. Thanks to <a href="https://stackoverflow.com/questions/25154056/plotting-of-2d-data-heatmap-with-different-colormaps/25155255#25155255">this</a> question I did the following:</p>
  
  <p><em>Sample Dataframe</em> (sample.csv):</p>
  
  <pre><code>X,a,b,c
  A,0.5,0.7,0.4
  B,0.9,0.3,0.8
  C,0.3,0.4,0.7
  </code></pre>
  
  <p><em>Plot Heatmap with Seaborn</em></p>
  
  <pre><code>import pandas as pd
  import matplotlib as mpl
  # Set new Backend to Use Seaborn
  # mpl.use('Agg')
  import seaborn as sns
  import matplotlib.pyplot as plt
  import matplotlib.cm as cm
  import colorsys
  
  # Working example data:
  df = pd.DataFrame([[0.5,0.7,0.4],[.9,.3,.8],[.3,.4,.7]],['A','B','C'])    
  
  # Get Color List
  N = 3
  COL = [colorsys.hsv_to_rgb(x*1.0/N, 0.7, 0.5) for x in range(N)]
  
  with sns.axes_style('white'):
  
      for i, name in enumerate(df.columns):
  
          # Create cmap
          colors = COL[i]
          cmap = sns.light_palette(colors, input='rgb', reverse=False, as_cmap=True)
  
          sns.heatmap(df.mask(df.isin(df[name])!=1),
                      cbar=False,
                      square=True,
                      annot=False,
                      cmap=cmap,
                      linewidths=0.1)
  plt.show()
  </code></pre>
  
  <p>This produce a heatmap with different colormaps / column (the values are only there to clarify the problem):</p>
  
  <p><a href="https://i.stack.imgur.com/QK9Uw.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QK9Uw.jpg" alt="enter image description here"></a></p>
  
  <p>Now I would like to produce the same plot using the sorted dataframe like:</p>
  
  <pre><code>X,col1,col2,col3
  A,0.7,0.5,0.4
  B,0.9,0.8,0.3
  C,0.7,0.4,0.3
  </code></pre>
  
  <p>Trying to keep the original color of the pair (index,column), like the following expected draft output (values are indicative, what I would need are only the colors):</p>
  
  <p><a href="https://i.stack.imgur.com/PnJ3M.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PnJ3M.jpg" alt="enter image description here"></a></p>
  
  <p>EDIT:</p>
  
  <p>Fixed some typos, now df is the dataframe representing the working matrix.</p>