title: Add legend of whole numbers instead of gradient in matplotlib
body: <p>I'd like to add a legend that is only whole numbers, i.e. 0,1,2,3...14, instead of the gradient color bar. Basically, I want the array values to have a unique color and label in the legend, so that you can clearly distinguish each value in the array.</p>
  
  <p><img src="https://i.stack.imgur.com/Wb4HX.png" alt="array plot of land area"></p>
  
  <pre><code>fileloc=os.path.join(basepath, infile)
  data=np.loadtxt(fileloc)
  
  fig = plt.figure(figsize=(20,10))
  plt.imshow(data)
  plt.colorbar()
  </code></pre>