title: 3D plotting: why are coordinate arguments input as 2D arrays?
body: <p>The mplot3d function <code>plot_surface</code> requires that the coordinates of the points defining the surface be input as three 2D arrays, X,Y,Z. Here is a working example that demonstrates the construction of these arrays. I express the x,y,z coordinates in spherical coordinates parameterized by the angles u and v. </p>
  
  <pre><code>import numpy as np
  import matplotlib.pyplot as plt
  from mpl_toolkits.mplot3d import Axes3D
  
  fig = plt.figure()
  ax = fig.add_subplot(111, projection = '3d')
  
  # generate the coordinates on the surface by parameterizing 
  u = np.linspace(0, 2 * np.pi, 100)
  v = np.linspace(0, 2 * np.pi, 100)
  x = np.outer(np.cos(u), np.sin(v))
  y = np.outer(np.sin(u), np.sin(v))
  z = np.outer(np.ones(np.size(u)), np.cos(v))
  
  ax.plot_surface(x, y, z) 
  plt.show()
  </code></pre>
  
  <p>I believe that the coordinates represented by X,Y,Z are precisely the set of all triplets <code>[X[i,j], Y[i,j], Z[i,j]]</code> indexed over i and j. <strong>(1)</strong> Is this correct? </p>
  
  <p>Many of the functions I have written to construct the real plot take an argument that is a list of triplets, precisely in the form of the triplet above; i.e. <code>points = [[x1,y1,z1], [x2,y2,z2], ..., [xn, yn, zn]]</code>. I anticipated that this input would be accepted by <code>plot_surface</code>, but it is not. As I result I find myself needing to convert between the two representations fairly frequently, e.g. via</p>
  
  <pre><code>points = zip(*[x.flatten() for x in (X,Y,Z)])
  </code></pre>
  
  <p>I can do so, but I am worried that I ought to be using the 2D array format for my own functions as well. <strong>(2)</strong> Is there a reason for the array input format other than it is easy to program the construction of these arrays? For example, is it computationally more efficient?</p>