At the moment I'm heavily using the scatter plot (great!). But if I want to add
a color bar (with the command colorbar(), directly following the call to
scatter) to explain the meaning of the colors of the patches, matplotlib (0.64)
refuses to make a colorbar with the following message:
First define a mappable image (eg imshow, figimage, pcolor, scatter
I checked how colorbar knows that the plot under consideration is a 'mappable
image': it calls gci() . And indeed, if I do that by hand, after a plot with
scatter, I get the message that there is no mappable image.
According to the doc's and the error message above, the patches plotted by
scatter should count as a mappable image, but apparently, they don't.
Is this a bug or a misunderstanding on my side?
PS: at the moment I'm using a workaround, by making my own colorbar command:
just stealing the code from the original routine, but without getting the
colors and number ranges from the image itself (I have to define those by