title: Surface Plot in Python - MemoryError
body: <p>I'm trying to create a surface plot using coordinates using the following code:</p>
  
  <pre><code>from mpl_toolkits.mplot3d import Axes3D
  from scipy.stats import gaussian_kde
  
  fig = plt.figure()
  ax = Axes3D(fig)
  X = []
  Y = []
  XY = np.vstack([X, Y])
  x, y = np.meshgrid(X, Y)
  z = gaussian_kde(XY)(XY).tolist()
  ax.plot_surface(x, y, z)
  plt.show()
  </code></pre>
  
  <p>Assume that X and Y are long lists of floating point numbers. However, when I execute the code I get a MemoryError, which traces back to the meshgrid method: <code>in meshgrid return [x * mult_fact for x in output]</code>.</p>
  
  <p>Does anyone know how to solve this?</p>
  
  <p>(When I alter the code to use a subset of the lists by writing <code>XY = np.vstack([X[0:10], Y[0:10]])</code> and <code>x, y = np.meshgrid(X[0:10], Y[0:10])</code> the surface plot works, but overlaps. I suppose this is due to the points not being plotted in order. Does anyone know how to resolve this also? I am new to Python...)</p>