I am using
I guess you have to fake your legend, since it requires a line for creating the legend.
You can do something like this:
import pylab as pl mycmap = pl.cm.jet # for example for entry in pl.unique(raw_data): mycolor = mycmap(entry*255/(max(raw_data) - min(raw_data))) pl.plot(0, 0, "-", c=mycolor, label=mynames[entry]) pl.imshow(raw_data) pl.legend()
Of cause this is not very satisfying yet. But maybe you can build something on that.
[edit: added missing parenthesis]