Print gray colormap in negative

That beeing said, I'm also in the need of a way of saving eps figures of gray
contours in negative, in order to save toner... with the standard gray
colormap, my contours are very dark, leading to a huge consumption of toner.

With a gray colormap "in negative", the result would be at least as readable
and consumes much less toner.

Two strategies are possible here:

- either display the gray colormap as usual on the screen, but save the figure
in negative with the "eps" or "png" backends (this is AFAIK the default
behaviour of IDL),

- or provide a "negative gray" colormap ; I've tried to hack the cm.py in that
way, and tried something like:

_ngray_data = {'red': ((0., 1, 1), (1., 0, 0)),
               'green': ((0., 1, 1), (1., 0, 0)),
               'blue': ((0., 1, 1), (1., 0, 0))}

but there seems to be a problem with the highest values, that keep beeing
displayed in white instead of black.

What do you think ?

PS: which place would be the more appropriate for this discussion, the -user
or -devel mailing list ?

Cheers,
Nicolas

···

On Wednesday 01 June 2005 18:38, John Hunter wrote:

Nicolas wants a standard
colormap but with the colorbar display inverted (red would still map
to large numbers but for vertical colorbars would be on the bottom and
for horizontal colorbars would be on the left -- the colorbar tick
labels would change too).

Nicolas Girard wrote:

That beeing said, I'm also in the need of a way of saving eps figures of gray contours in negative, in order to save toner... with the standard gray colormap, my contours are very dark, leading to a huge consumption of toner.

With a gray colormap "in negative", the result would be at least as readable and consumes much less toner.

Two strategies are possible here:

- either display the gray colormap as usual on the screen, but save the figure in negative with the "eps" or "png" backends (this is AFAIK the default behaviour of IDL),

-1. One of mpl's strengths is that it shows you on screen what you get on paper, I'd _hate_ to folow IDL here (or for that matter, on just about anything else).

- or provide a "negative gray" colormap ; I've tried to hack the cm.py in that way, and tried something like:

_ngray_data = {'red': ((0., 1, 1), (1., 0, 0)),
               'green': ((0., 1, 1), (1., 0, 0)),
               'blue': ((0., 1, 1), (1., 0, 0))}

I've meen meaning to add a .reversed() method to the colormap instances, which will automatically return an instance of the given colormap with its lookup table reversed, and the name simply with a suffix appended (_r, _rev, r, ...). I think this is the right solution, and I also think we should supply, by default, reversed versions of the standard colormaps. At the very least, the gray_rev (or whatever it gets called) can be _extremely_ useful.

but there seems to be a problem with the highest values, that keep beeing displayed in white instead of black.

Mmh, I haven't seen this. I have the same defined in my default run-time config loaded by ipython, and I haven't seen this kind of clipping, but maybe I just haven't noticed it. I've been using matshow() and haven't seen this, I'll look again in more detail later.

Cheers,

f