title: Why Z has to be 2-dimensional for 3d plotting in matplotlib
body: <p>I am trying to plot 3d <code>Surface plots</code> using code from <a href="http://jeffskinnerbox.me/notebooks/matplotlib-2d-and-3d-plotting-in-ipython.html" rel="noreferrer">this site</a> using  matplotlib: </p>
  
  <p>X,Y and Z are obtained as below: </p>
  
  <pre><code>from math import pi
  from numpy import cos, meshgrid
  alpha = 0.7
  phi_ext = 2 * pi * 0.5
  
  def flux_qubit_potential(phi_m, phi_p):
      return 2 + alpha - 2 * cos(phi_p)*cos(phi_m) - alpha * cos(phi_ext - 2*phi_p)
  
  phi_m = linspace(0, 2*pi, 100)
  phi_p = linspace(0, 2*pi, 100)
  X,Y = meshgrid(phi_p, phi_m)
  Z = flux_qubit_potential(X, Y).T
  </code></pre>
  
  <p>And 3d plotting is done with following code: </p>
  
  <pre><code>from mpl_toolkits.mplot3d.axes3d import Axes3D
  
  fig = plt.figure(figsize=(14,6))
  
  # `ax` is a 3D-aware axis instance, because of the projection='3d' keyword argument to add_subplot
  ax = fig.add_subplot(1, 2, 1, projection='3d')
  
  p = ax.plot_surface(X, Y, Z, rstride=4, cstride=4, linewidth=0)
  
  # surface_plot with color grading and color bar
  ax = fig.add_subplot(1, 2, 2, projection='3d')
  p = ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.coolwarm, linewidth=0, antialiased=False)
  cb = fig.colorbar(p, shrink=0.5)
  </code></pre>
  
  <p>However, if I replace X,Y and Z by my x,y,z 3d data (sample give below), there is an error that <code>Z has to be 2 dimensional</code>. How can I plot with usual x,y,z values, as following: </p>
  
  <pre><code>   x   y   z
  0  12  0  0.1
  1  13  1  0.8
  2  14  3  1.0
  3  16  4  1.2
  4  18  4  0.7
  </code></pre>