title: Python - construction of meshgrid (irregular grid) with numpy
body: <p>My aim is to interpolate some data. To do that i have to create a meshgrid.
  To do this step, i got an array with my 2D coordinate "coord" (first column : element number, second : X and third : Y).</p>
  
  <p>I do a meshgrid with np.meshgrid as you can see below.
  But my results seem to be strange, so i would like to know if i have done
  a mistake...Must i have to reorganize my data before meshgrid step?</p>
  
  <pre><code>import numpy as np
  coord = np.array([[  1.        ,  -1.38888667,  -1.94444333],
         [  2.        ,  -1.94444333,  -1.38888667],
         [  3.        ,   0.27777667,  -1.94444333],
         [  4.        ,  -0.27777667,  -1.38888667],
         [  5.        ,   1.94444333,  -1.94444333],
         [  6.        ,   1.38888667,  -1.38888667],
         [  7.        ,  -1.38888667,  -0.27777667],
         [  8.        ,  -1.94444333,   0.27777667],
         [  9.        ,   0.27777667,  -0.27777667],
         [ 10.        ,  -0.27777667,   0.27777667],
         [ 11.        ,   1.94444333,  -0.27777667],
         [ 12.        ,   1.38888667,   0.27777667],
         [ 13.        ,  -1.38888667,   1.38888667],
         [ 14.        ,  -1.94444333,   1.94444333],
         [ 15.        ,   0.27777667,   1.38888667],
         [ 16.        ,  -0.27777667,   1.94444333],
         [ 17.        ,   1.94444333,   1.38888667],
         [ 18.        ,   1.38888667,   1.94444333]])
  
  [Y,X]=np.meshgrid(coord[:,2],coord[:,1])
  </code></pre>
  
  <p>If i plot Y, i got that : </p>
  
  <pre><code>plt.imshow(Y);plt.colorbar();plt.show()
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/C85zD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/C85zD.png" alt="enter image description here"></a></p>
  
  <p>---- EDIT LATER -----</p>
  
  <p>I m wondering (for example) if the coordinates with meshgrid have to be strictly increasing? if there is a better way when i have some coordinates not organized?</p>
  
  <p>For the interpolation, i would like to use :</p>
  
  <pre><code>def interpolate(values, tri,uv,d=2):
      simplex = tri.find_simplex(uv)
      vertices = np.take(tri.simplices, simplex, axis=0)
      temp = np.take(tri.transform, simplex, axis=0)
      delta = uv- temp[:, d]
      bary = np.einsum('njk,nk-&gt;nj', temp[:, :d, :], delta)  
      return np.einsum('nj,nj-&gt;n', np.take(values, vertices),  np.hstack((bary, 1.0 - bary.sum(axis=1, keepdims=True))))
  </code></pre>
  
  <p>which was used in Stack before <a href="https://stackoverflow.com/questions/20915502/speedup-scipy-griddata-for-multiple-interpolations-between-two-irregular-grids">Speedup scipy griddata for multiple interpolations between two irregular grids</a> allowing to limit the calculation time </p>