title: Why does meshgrid order output dimensions differently than the order provided with input?
body: <p>I'm trying to understand how meshgrid indexes dimensions of the outputs with respect to the inputs. I've noticed it will always transpose the first two dimensions. For example, when providing x with length 7 and y with length 6 it will return the output arrays as a 6x7 array instead of a 7x6 one.</p>
  
  <p>This is clearly by design so I'm trying to understand the why/logic so I can use it as intended. Can someone shine a light on this? Thanks!</p>
  
  <pre><code>import numpy as np
  
  #specify input dimensions of different lengths to aid in identifying which output index a dimension belongs to
  x = np.linspace(0,60,7)
  y = np.linspace(0,50,6)
  z = np.linspace(0,40,5)
  i = np.linspace(0,30,4)
  j = np.linspace(0,20,3)
  
  #2D mesh grid, output dimensions transposed from input
  xx, yy = np.meshgrid(x,y)
  print(xx.shape)
  print(yy.shape)
  
  #3D mesh grid, first two output dimensions transposed from input
  xx, yy, zz = np.meshgrid(x,y,z)
  print(xx.shape)
  print(yy.shape)
  print(zz.shape)
  
  #4D meshgrid, first two output dimensions transposed from input, rest are in input order
  xx, yy, zz, ii = np.meshgrid(x,y,z,i)
  print(xx.shape)
  print(yy.shape)
  print(zz.shape)
  print(ii.shape)
  
  #5D meshgrid, first two output dimensions transposed from input, rest are in input order
  xx, yy, zz, ii, jj = np.meshgrid(x,y,z,i,j)
  print(xx.shape)
  print(yy.shape)
  print(zz.shape)
  print(ii.shape)
  print(jj.shape)
  </code></pre>