title: Why does pyplot.contour() require Z to be a 2D array?
body: <p>The <code>matplotlib.pyplot.contour()</code> function takes 3 input arrays <code>X</code>, <code>Y</code> and <code>Z</code>.<br>
  The arrays <code>X</code> and <code>Y</code> specify the x- and y-coordinates of points, while <code>Z</code> specifies the corresponding value of the function of interest evaluated at the points.</p>
  
  <p>I understand that <code>np.meshgrid()</code> makes it easy to produce arrays which serve as arguments to <code>contour()</code>:</p>
  
  <pre><code>X = np.arange(0,5,0.01)
  Y = np.arange(0,3,0.01)
  
  X_grid, Y_grid = np.meshgrid(X,Y)
  Z_grid = X_grid**2 + Y_grid**2
  
  plt.contour(X_grid, Y_grid, Z_grid)  # Works fine
  </code></pre>
  
  <p>This works fine. And conveniently, this works fine too:</p>
  
  <pre><code>plt.contour(X, Y, Z_grid)  # Works fine too
  </code></pre>
  
  <p>However, why is the <code>Z</code> input <strong><em>required</em></strong> to be a 2D-array?  </p>
  
  <p>Why is something like the following disallowed, even though it specifies all the same data aligned appropriately?</p>
  
  <pre><code>plt.contour(X_grid.ravel(), Y_grid.ravel(), Z_grid.ravel())  # Disallowed
  </code></pre>
  
  <p>Also, what are the semantics when <strong>only</strong> <code>Z</code> is specified (without the corresponding <code>X</code> and <code>Y</code>)?</p>