title: Matplotlib - Contour plot with single value
body: <p>I want to make a contour plot of some data, but it is possible that all values in the field at the same value.  This causes an error in matplotlib, which makes sense since there really isn't a contour to be created.  For example, if you run the code below, you will get an error, but delete the second definition of <code>zi</code> and it runs as expected.</p>
  
  <p>How can I make a "contour" plot for some data if it is a uniform field? I want it to look just like the regular contour plot (to have a box filled with some color and to show a color bar on the side.  The color bar could be a uniform color, or still show a range of 15 colors, I don't care).</p>
  
  <p>Code:</p>
  
  <pre><code>from numpy        import array
  import matplotlib.pyplot as plt
  
  xi = array([0., 0.5, 1.0])
  yi = array([0., 0.5, 1.0])
  zi = array([[0., 1.0, 2.0],
              [0., 1.0, 2.0],
              [0., 1.0, 2.0]])
  zi = array([[1.0, 1.0, 1.0],
              [1.0, 1.0, 1.0],
              [1.0, 1.0, 1.0]])
  
  CS = plt.contour(xi, yi, zi, 15, linewidths=0.5, colors='k')
  CS = plt.contourf(xi, yi, zi, 15, cmap=plt.cm.jet)
  plt.colorbar()
  plt.show()
  </code></pre>