I’m using colorbar with the default “jet” map and use that with “hexbin”. I have counts in my bins that range from 0 to about 1500. The problem is that the smallest values in some hexagonal bins are between 1 and 10, while some bins have counts of hundreds. This means that in the jet colormap, the 0 to 10 range comes up as the color 0 — i.e. it is indistinguishable from a bin with 0 counts. I’d like those small values to be visible. How can I make colormap do something like: make sure that the bin values greater than or equal to N have a “visible”, meaning different from the 0 bin, value in the color map?
thanks.
A quick fix could be try plotting
log(counts)instead of counts on the hexbin — this will spread the scale such that higher counts are compressed and lower counts are not.Note though, you’d have to put somewhere that the value being visualised is
log(counts)notcountsor else a casual reader would inariably misinterpret the graph.A better method might be to modify the colour map that you’re using.
The in-built maps more or less change from the ‘0’ colour to the ‘1’ colour linearly.
In order to make lower values have more spread in colour than the higher values, you need a non-linear colour map.
To do this you might try
matplotlib.colors, and in particularmatplotlib.colors.LinearSegmentedColormap.from_list(http://matplotlib.sourceforge.net/api/colors_api.html#matplotlib.colors.LinearSegmentedColormap.from_list)Basically, you input the ‘0’ and ‘1’ colours (like blue–>red) and a gamma value. Having gamma > 1.0 increases sensitivity in the lower part of the scale.
If haven’t tried, but something like: