I was recently asked how to make a nonlinear colormap. That is, a colormap that would have breaks at specified levels so that you can add details where they are important. And example is a filled contour of topography, where it is important to show details in the shallow regions, but also the larger changes from the shelf to the deep ocean. Desired levels are often approximately exponentially increasing (but it's also nice to have contour lines be on round numbers).
Attached is my solution to this problem, with the resulting figure. I am not sure this is the best way, and I'm interested to see if anybody has anything better to offer.
Also, what's up with the warnings? Can I get rid of these (in a better way than just 'ignoring' them?)
nlcmap.py (1.18 KB)