title: tripcolor using RGB values for each vertex
body: <p>I have a 2D triangle mesh with n vertices that is stored in a variable <code>tri</code> (a matplotlib.tri.Triangulation object); I can plot the mesh with matplotlib's tripcolor function easily enough and everything works fine. However, I also have (r,g,b) triples for each vertex (<code>vcolors</code>), and these values do not fall along a single dimension thus can't be easily converted to a color-map (for example, imagine if you overlaid a triangle mesh on a large photo of a park, then assigned each vertex the color of the pixel beneath it).</p>
  
  <p>I thought I would be able to do something like this:</p>
  
  <pre><code>matplotlib.pyplot.tripcolor(tri, vcolors)
  </code></pre>
  
  <blockquote>
    <p>ValueError: Collections can only map rank 1 arrays</p>
  </blockquote>
  
  <p>Is there a convenient way to convert a <code>vcolors</code>-like (n x 3) matrix into something usable by tripcolor? Is there an alternative to tripcolor that accepts vertex colors?</p>
  
  <p>One thing I have tried is to make my own colormap:</p>
  
  <pre><code>z = numpy.asarray(range(len(vcolors)), dtype=np.float) / (len(vcolors) - 1)
  cmap = matplotlib.colors.Colormap(vcolors, N=len(vcolors))
  matplotlib.pyplot.tripcolor(tri, z, cmap=cmap)
  matplotlib.pyplot.show()
  </code></pre>
  
  <p>This however did nothing---no figure appears and no error is raised; the function returns a figure handle but nothing ever gets rendered (I'm using an IPython notebook). Note that if I call the following, a plot appears just fine:</p>
  
  <pre><code>tripcolor(tri, np.zeros(len(vcolors)))
  matplotlib.pyplot.show()
  </code></pre>
  
  <p>I'm using Python 2.7.</p>