title: Python seaborn heatmap grid - Not taking expected columns
body: <p>I have following pandas dataframe. Basically, 7 different action categories, 5 different targets, each category has 1 or many unique endpoints, then each endpoint got a certain score in each target. 
  There are total 250 endpoints.</p>
  
  <pre><code>action,target,endpoint,score
  Category1,target1,endpoint1,813.0
  Category1,target2,endpoint1,757.0
  Category1,target3,endpoint1,155.0
  Category1,target4,endpoint1,126.0
  Category1,target5,endpoint1,75.5
  Category2,target1,endpoint2,106.0
  Category2,target1,endpoint3,101.0
  Category2,target1,endpoint4,499.0
  Category2,target1,endpoint5,207.0
  Category2,target2,endpoint2,316.0
  Category2,target2,endpoint3,208.0
  Category2,target2,endpoint4,161.0
  Category2,target2,endpoint5,198.0
  &lt;omit&gt;
  Category3,target1,endpoint8,193.0
  Category3,target1,endpoint9,193.0
  Category3,target1,endpoint10,193.0
  Category3,target1,endpoint11,193.0
  Category3,target2,endpoint8,193.0
  Category3,target2,endpoint9,193.0
  &lt;List goes on...&gt;
  </code></pre>
  
  <p>Now, I wanted to map out this dataframe as heatmap per category.
  So, I used seabron facet grid heatmap with the following code.</p>
  
  <pre><code>import pandas as pd
  import matplotlib.pyplot as plt
  import seaborn as sns
  
  data = pd.read_csv('rawData.csv')
  data = data.drop('Unnamed: 0', 1)
  
  
  def facet_heatmap(data, **kwargs):
  
  
      data2 = data.pivot(index="target", columns='endpoint', values='score')
      ax1 = sns.heatmap(data2, cmap="YlGnBu", linewidths=2)
  
      for item in ax1.get_yticklabels():
          item.set_rotation(0)
  
      for item in ax1.get_xticklabels():
          item.set_rotation(70)
  
  
  with sns.plotting_context(font_scale=5.5):
  
      g = sns.FacetGrid(data, col="action", col_wrap=7, size=5, aspect=0.5)
  
  cbar_ax = g.fig.add_axes([.92, .3, .02, .4])  
  
  g = g.map_dataframe(facet_heatmap, cbar=cbar_ax, min=0, vmax=2000)
  # &lt;-- Specify the colorbar axes and limits
  
  g.set_titles(col_template="{col_name}", fontweight='bold', fontsize=18)
  g.fig.subplots_adjust(right=3)  # &lt;-- Add space so the colorbar doesn't overlap the plot
  
  plt.savefig('seabornPandas.png', dpi=400)
  plt.show()
  </code></pre>
  
  <p>It actually generates heatmap grid. However, the problem is the each heatmap uses the same column for some reason. See attached screenshot below.</p>
  
  <p><a href="https://i.stack.imgur.com/vJv2j.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vJv2j.png" alt="As you may notice, it is quite odd."></a> 
  (Please ignore color bar and limits.)</p>
  
  <p>This is quite odd. First, the Index is not in order. Second, each heatmap box only takes the last three endpoints (Endpoint 248, 249, and 250). This is incorrect. For category 1, it should take endpoint 1 only. I don't expect a gray box there..</p>
  
  <p>For category2, it should take endpoint 2,3,4,5. Not endpoint 248, 249, 250.</p>
  
  <p>How can I fix these two issues? Any suggestion or comments are welcome.</p>