title: Using scipy.stats.gaussian_kde with 2 dimensional data
body: <p>I'm trying to use <a href="http://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.gaussian_kde.html" rel="noreferrer">the <code>scipy.stats.gaussian_kde</code> class</a> to smooth out some discrete data collected with latitude and longitude information, so it shows up as somewhat similar to a contour map in the end, where the high densities are the peak and low densities are the valley.</p>
  
  <p>I'm having a hard time putting a two-dimensional dataset into the <code>gaussian_kde</code> class. I've played around to figure out how it works with 1 dimensional data, so I thought 2 dimensional would be something along the lines of:</p>
  
  <pre><code>from scipy import stats
  from numpy import array
  data = array([[1.1, 1.1],
                [1.2, 1.2],
                [1.3, 1.3]])
  kde = stats.gaussian_kde(data)
  kde.evaluate([1,2,3],[1,2,3])
  </code></pre>
  
  <p>which is saying that I have 3 points at <code>[1.1, 1.1], [1.2, 1.2], [1.3, 1.3]</code>. and I want to have the kernel density estimation using from 1 to 3 using width of 1 on x and y axis.</p>
  
  <p>When creating the gaussian_kde, it keeps giving me this error:</p>
  
  <pre><code>raise LinAlgError("singular matrix")
  numpy.linalg.linalg.LinAlgError: singular matrix
  </code></pre>
  
  <p>Looking into the source code of <code>gaussian_kde</code>, I realize that the way I'm thinking about what dataset means is completely different from how the dimensionality is calculate, but I could not find any sample code showing how multi-dimension data works with the module. Could someone help me with some sample ways to use <code>gaussian_kde</code> with multi-dimensional data?</p>