title: rescaling axes on pcolor plot from pandas data frame
body: <p>I'm inputting data from a text file with column structure more or less like this:</p>
  
  <pre><code>x   y   density
  </code></pre>
  
  <p>I need to plot a heat map of density(x,y).</p>
  
  <p>I'm just getting started with pyplot and pandas and I'm not sure how to achieve this functionality efficiently.</p>
  
  <p>I first tried just loading in the columns and plotting with </p>
  
  <pre><code>plt.pcolor( OrbData[['x']], OrbData[['y']], OrbData[['density']]  )
  </code></pre>
  
  <p>but this failed because the color values must be in an array.  So now I'm using the x,y values as a multi-index and unpacking the data frame.</p>
  
  <p>Here is my script</p>
  
  <pre><code>import matplotlib.pyplot as plt 
  import numpy as np
  import pandas as pd
  
  Morbs = 2 
  OrbFile = "69.0000000orbs.dat"
  
  ### Load in the data using pandas
  OrbData = pd.read_csv(OrbFile, sep='\s+', usecols = [ 0, 1, 7 ], header= None, names=['x','y','density'], skiprows=2)
  OrbData = OrbData.set_index(['x','y'])
  OrbData=OrbData.unstack()
  
  plt.figure(1)
  plt.pcolor(OrbData[['density']], cmap='hot')
  plt.gca().set_aspect('equal')
  plt.show()
  </code></pre>
  
  <p>this almost works perfectly, but the axes in the plot show the record number (0,50) rather than the index values (-2,2). </p>
  
  <p>If I try <code>plt.pcolor(OrbData[['x']], OrbData[['y']], OrbData[['Mag1']], cmap='hot')</code>  with the unpacked data, I get an error 
  <code>KeyError: "['x'] not in index"</code>.</p>
  
  <p>If I try to access the index values using <code>OrbData.index</code> I only recover the x-values (rows), and I can't figure out how to access the y-values (columns).</p>
  
  <p>There are several ways I can think to do this, but they all feel hacky and inefficient.</p>
  
  <p>1) save the x,y columns separately before the unpack</p>
  
  <p>2) transpose the dataframe and use OrbData.index to get the y-values</p>
  
  <p>3) manually rescale the axes in pyplot somehow</p>
  
  <p>I'm trying to make ~10^5 plots for animations and each plot has at least 10^4 records so I need something that isn't too wasteful.<br>
  there must be some simple way to pull the values from the column data in a format that pcolor can read.</p>
  
  <p>any ideas?</p>