title: matplotlib triplot and tricontourf
body: <p>I'm attempting to plot a 2D dataset having unstructured coordinates in <code>matplotlib</code> using <code>tricontourf</code>. I'm able to generate a plot of the 'mesh' with <code>triplot</code>, however when I use the same <code>Triangulation</code> object for <code>tricontourf</code>, I get an error (see below). What am I missing? Example:</p>
  <pre><code>#!/usr/bin/env python3
  # -*- coding: utf-8 -*-
  
  import numpy as np
  import matplotlib as mpl
  import matplotlib.pyplot as plt
  
  def lower(x):
      return 2 + 1*x
  
  def upper(x):
      return 60 + 4*x
  
  ni = 10
  nj = 12
  
  x = np.linspace(1,15,ni)
  
  ## make a trapezoid
  xy = np.zeros((ni,nj,2),dtype=np.float32)
  for i in range(len(x)):
      y = np.linspace(lower(x[i]),upper(x[i]),nj)
      xy[i,:,0] = x[i]
      xy[i,:,1] = y
  
  ## add noise
  xy += -0.1 + 0.2*np.random.rand(ni,nj,2)
  
  ## make tris 'indices list'
  xi, yi    = np.meshgrid(range(ni), range(nj), indexing='xy')
  inds_list = np.stack((xi,yi), axis=2)
  inds_list = np.reshape(inds_list, (ni*nj,2), order='C')
  inds_list = np.ravel_multi_index((inds_list[:,0],inds_list[:,1]), (ni,nj), order='C')
  inds_list = np.reshape(inds_list, (ni,nj), order='F')
  
  tris = np.zeros((2*(ni-1)*(nj-1),3), dtype=np.int64)
  ci=0
  for i in range(ni-1):
      for j in range(nj-1):
          tris[ci,0] = inds_list[i+1, j+1]
          tris[ci,1] = inds_list[i,   j+1]
          tris[ci,2] = inds_list[i,   j  ]
          ci+=1
          tris[ci,0] = inds_list[i,   j  ]
          tris[ci,1] = inds_list[i+1, j  ]
          tris[ci,2] = inds_list[i+1, j+1]
          ci+=1
  
  triangulation = mpl.tri.Triangulation(x=xy[:,:,0].ravel(), y=xy[:,:,1].ravel(), triangles=tris)
  
  fig1 = plt.figure(figsize=(4, 4/(16/9)), dpi=300)
  ax1 = plt.gca()
  ax1.triplot(triangulation, lw=0.5)
  #ax1.tricontourf(triangulation)
  fig1.tight_layout(pad=0.25)
  plt.show()
  </code></pre>
  <p>...produces</p>
  <p><a href="https://i.stack.imgur.com/Udamu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Udamu.png" alt="enter image description here" /></a></p>
  <p>however, uncommenting the line with <code>ax1.tricontourf</code></p>
  <p>throws the error:</p>
  <pre><code>Traceback (most recent call last):
    File &quot;test.py&quot;, line 54, in &lt;module&gt;
      ax1.tricontourf(triangulation)
    File &quot;C:\Users\steve\AppData\Roaming\Python\Python38\site-packages\matplotlib\tri\tricontour.py&quot;, line 307, in tricontourf
      return TriContourSet(ax, *args, **kwargs)
    File &quot;C:\Users\steve\AppData\Roaming\Python\Python38\site-packages\matplotlib\tri\tricontour.py&quot;, line 29, in __init__
      super().__init__(ax, *args, **kwargs)
    File &quot;C:\Users\steve\AppData\Roaming\Python\Python38\site-packages\matplotlib\contour.py&quot;, line 812, in __init__
      kwargs = self._process_args(*args, **kwargs)
    File &quot;C:\Users\steve\AppData\Roaming\Python\Python38\site-packages\matplotlib\tri\tricontour.py&quot;, line 45, in _process_args
      tri, z = self._contour_args(args, kwargs)
    File &quot;C:\Users\steve\AppData\Roaming\Python\Python38\site-packages\matplotlib\tri\tricontour.py&quot;, line 60, in _contour_args
      z = np.ma.asarray(args[0])
  IndexError: list index out of range
  </code></pre>
  <p>I am using:</p>
  <p>Python version: 3.8.9</p>
  <p>matplotlib version: 3.5.1</p>