title: What is the purpose of meshgrid in Python / NumPy?
body: <p>Can someone explain to me what is the purpose of <code>meshgrid</code> function in Numpy? I know it creates some kind of grid of coordinates for plotting, but I can't really see the direct benefit of it.</p>
  
  <p>I am studying "Python Machine Learning" from Sebastian Raschka, and he is using it for plotting the decision borders. See input 11 <a href="https://github.com/rasbt/python-machine-learning-book/blob/master/code/ch03/ch03.ipynb" rel="noreferrer">here</a>.</p>
  
  <p>I have also tried this code from official documentation, but, again, the output doesn't really make sense to me.</p>
  
  <pre><code>x = np.arange(-5, 5, 1)
  y = np.arange(-5, 5, 1)
  xx, yy = np.meshgrid(x, y, sparse=True)
  z = np.sin(xx**2 + yy**2) / (xx**2 + yy**2)
  h = plt.contourf(x,y,z)
  </code></pre>
  
  <p>Please, if possible, also show me a lot of real-world examples.</p>