import brewer2mpl
import numpy as np
a = np.random.rand(3) # a[0] represents value of rect1, a[1] of rect[2]....
def get_colors():
"""
Get colorbrewer colors, which are nicer
"""
bmap = brewer2mpl.get_map('Accent','qualitative',6)
return bmap.mpl_colors
rect1 = matplotlib.patches.Rectangle((2,2), 1, 1, color='yellow'))
ax.add_patch(rect1)
rect2 = matplotlib.patches.Rectangle((3,3), 1, 1, color='green'))
ax.add_patch(rect2)
rect3 = matplotlib.patches.Rectangle((5,5), 1, 1, color='red'))
ax.add_patch(rect3)
I would like the color of the rectangle to vary based on the value of the vector 'a'. Instead of pure yellow/green/red color, select a color from a range, preferably the brewer2mpl colors

