title: getting ValueError: 'vertices' must be a 2D list or array with shape Nx2, when it is Nx2?
body: <p>I am trying to plot a mesh using node coordinates and connectivity as outlined here:</p>
  
  <p><a href="http://stackoverflow.com/questions/52202014/how-can-i-plot-2d-fem-results-using-matplotlib">link</a></p>
  
  <p>I have a list of node coordinates stored in a numpy array (x y and z coordinates)</p>
  
  <p>I define x and y as:</p>
  
  <pre><code>x = coords[:,0]
  y = coords[:,1]
  </code></pre>
  
  <p>I have the node connectivity in a numpy array <code>connectivity</code>, it has the id numbers of the coordinates that connect together</p>
  
  <p>then, following their example, do the following:</p>
  
  <pre><code>xy = np.c_[x,y]
  verts= xy[connectivity]
  pc = matplotlib.collections.PolyCollection(verts)
  </code></pre>
  
  <p>and I get this error:</p>
  
  <pre><code>  File "C:\Users\deden\AppData\Local\Continuum\anaconda3\envs\dhi\lib\site-packages\matplotlib\path.py", line 130, in __init__
      "'vertices' must be a 2D list or array with shape Nx2")
  
  ValueError: 'vertices' must be a 2D list or array with shape Nx2
  </code></pre>
  
  <p>to check:</p>
  
  <p><code>xy.shape[1]</code> is 2 and 
  <code>xy.ndim</code> is 2</p>
  
  <p>the line 130 in the file in the traceback is:</p>
  
  <pre><code>vertices = _to_unmasked_float_array(vertices)
  if vertices.ndim != 2 or vertices.shape[1] != 2:
      raise ValueError(
          "'vertices' must be a 2D list or array with shape Nx2")
  </code></pre>
  
  <p>and <code>_to_unmasked_float_array(vertices)</code> calls:</p>
  
  <pre><code>def _to_unmasked_float_array(x):
      """
      Convert a sequence to a float array; if input was a masked array, masked
      values are converted to nans.
      """
      if hasattr(x, 'mask'):
          return np.ma.asarray(x, float).filled(np.nan)
      else:
          return np.asarray(x, float)
  </code></pre>
  
  <p>I don't understand why I am getting this error msg if <code>verts.shape[1]</code> and <code>verts.ndim</code> = 2</p>
  
  <p>also <code>np.asarray(verts, float).shape[1]</code> and <code>np.asarray(verts, float).ndim</code> is also 2</p>
  
  <p>what the heck is going on? am I missing something? would really appreciate anyones help</p>
  
  <p>also..</p>
  
  <pre><code>verts.shape
  </code></pre>
  
  <p>returns</p>
  
  <pre><code>(181660, 2)
  </code></pre>