A (broken) patch to allow colorbars to be reversed

Hi all,

with most of my contours, upper values are on the left side and lower values
on the right side ; to the contrary the colorbar (created with
orientation='horizontal') displays colors ranging from the lowest to the
highest ; this leads to an unpleasant look. (No, I cannot reverse my whole
contours, their orientation is important :wink:

What I'd find useful is a "reverse" option that would make the colorbar
display colors ranging from the highest to the lowest ; and I've tried to
hack the figure.py file.

You'll find the attached patch as a result. apart from fixing a pair of typos
in the docstring, it allows *colors* of the colorbars to be reversed, but not
its ticks :-/

Then I'm afraid this patch is all but useful... but perhaps it helps getting
the idea. I'd glad if this feature could be added to the colorbar...

Thanks for reading,

Cheers,
Nicolas

figure.py_reverse.patch (1.52 KB)

Nicolas Girard wrote:

Hi all,

with most of my contours, upper values are on the left side and lower values on the right side ; to the contrary the colorbar (created with orientation='horizontal') displays colors ranging from the lowest to the highest ; this leads to an unpleasant look. (No, I cannot reverse my whole contours, their orientation is important :wink:

What I'd find useful is a "reverse" option that would make the colorbar display colors ranging from the highest to the lowest ; and I've tried to hack the figure.py file.

mmh, just yesterday I was talking to JDH about this: I have the feeling that the right place to implement this would be to provide colormaps (the beasts lurking underneath colorbars) with an easy way to get reversed versions. I don't think that a hack at the level of the colorbar function is the right place, design wise, to do this. But I could be wrong...

I've been meaning to make some changes to the colormaps code to fix this along with a number of other annoyances it has, but I haven't gotten around to it yet.

Best,

f