From: Eric F. <ef...@ha...> - 2009-08-12 23:16:49
|
Reinier Heeres wrote: > Hi all, > > I would like to propose the attached patch to be able to use a gamma > value for color maps. This will make it simple to make your color > scale more 'sensitive' at the bottom or at the top, as can be seen in > the attached example. This could in principle also be solved by adding > a gamma normalizer, but I think that applying it to a color map is > quite coming practice, so in this case the preferred way. Your patch looks reasonable to me. > > I'd also like to add a few extra color maps (at least one plain > blue-white-red and one with darker shades at the high and low ends, as Good. > in the attachment). I also remember a particular one ('terrain') in a > measurement program called 'Igor' that would be nice. Is there any potential licensing problem? I hope not. I presume you would copy the effect, not any particular set of numbers extracted from Igor. > > Looking at _cm.py, I would guess that could be done a bit more > efficient than the current 5880 lines as well by just specifying a few > colors and using LinearSegmentedColormap.from_list(). Is it ok if I > try to refactor that? You mean take the colormaps that have a huge number of color dictionary entries in _cm.py, and subsample them down to something reasonable? Please do! I always hated those blocks of numbers, but never enough to motivate me to do something about them other than a little reformatting. It sounds like you are talking about going farther than that, which might be fine but might make things more complicated. As it is now, all the built-in colormaps are associated with color dictionaries for direct use in LinearSegmentedColormap. If you make two styles, one based on the dictionaries (which allows discontinuities) and one based on from_list (which does not), then you need to keep track of which is which. Is it worth it? I am inclined to stick with the cdict approach. It looks like an obvious addition would a function that takes a list of breakpoints (starting with 0 and ending with 1) and a matching list of colors and generates the corresponding cdict for continuous mapping. Eric > > Let me know what you think. > > Cheers, |