The colorbar() function only works with things like images that use a colormap--that is, a function that maps an interval onto a range of colors, typically by linear interpolation. When you use set_facecolor, you are setting colors explicitly instead of having them calculated from a colormap. I've thought about extending the colorbar function so it could handle this case, but I haven't done it and probably won't within the next week or two.
I'm somewhat of a newbie and I have hopefully a simple question (people asking
similar questions in the archive seem to be beyond this already). I have a
working color fill generated using the set_facecolor command on a collection of
polygons. When I try to use colorbar() I get the message: cmap = mappable.cmp AttributeError: 'NoneType' object has no
This question could be a little lacking in information? Maybe someone has a bit
of sample code that already does something like this?