title: How to fill polygons with colors based on a variable in Matplotlib?
body: <p>I've been working with a shapefile that has the x and y coordinates of the vertices of several buildings, and I am using Matplotlib to plot them as polygons. However, I would like to fill these polygons with shades of red/grey/or any other color based on the number of floors each building has. For example, the minimum number of floors is zero, so all buildings with zero floors would be of very light color. On the other hand, the maximum number of floors is 100, so all buildings with a hundred floors would plot very dark, and between 0 and 100 the polygons would plot darker and darker as the number of floors increased.</p>
  
  <p>I found a few things online but nothing that tackles this specifically. I am new at Python so maybe I am just not aware of the right library that can do what I need.</p>
  
  <p>My code for now is this: (It plots the polygons only, no fill) </p>
  
  <pre><code>import shapefile
  import matplotlib.pyplot as plt
  import numpy as np
  
  i = 0
  sf = shapefile.Reader('shapefile')
  sr = sf.shapeRecords()
  max = 10
  
  
  while i &lt; max:
      sr_obj = sr[i]
      sr_points = np.array(sr_obj.shape.points)
      records = sf.record(i)
      numfloors = records[42]
      x = sr_points[:,0]
      y = sr_points[:,1]
      sr_plot = zip(*sr_points)
      plt.plot(*sr_plot)
      i = i + 1
  
  plt.show() 
  </code></pre>
  
  <p>Thank you!</p>