mplot3d/axis3d.py : scientific notation

Hello,

scientific notation is not available in 3D axes with matplotlib 1.0.1.

When the ScalarFormatter uses scientific notation, the exponent is indicated at the end of the axis for 2D graphics, but in 3D graphics this exponent is simply forgotten.

I think the file mpl_toolkits/mplot3d/axis3d.py should call scalarFormatter.get_offset() and display the result somewhere.

Best regards,

O.C.

PS: The matplotlib web page mentions a bug tracker, but it's not available to me ("Error - The Tracker has been disabled for this group").

Hello,

scientific notation is not available in 3D axes with matplotlib 1.0.1.

When the ScalarFormatter uses scientific notation, the exponent is
indicated at the end of the axis for 2D graphics, but in 3D graphics
this exponent is simply forgotten.

I think the file mpl_toolkits/mplot3d/axis3d.py should call
scalarFormatter.get_offset() and display the result somewhere.

Best regards,

O.C.

This has been fixed already and will be in the upcoming v1.1.0 release.

PS: The matplotlib web page mentions a bug tracker, but it's not
available to me ("Error - The Tracker has been disabled for this group").

We now use github for our issue tracking.

Ben Root

···

On Saturday, July 16, 2011, OC <oc-spam65@...987...> wrote:

I came across this website where different colormaps have been compared and the author has come up with an optimal colormap for data visualization called the "cool-warm colormap".

http://www.cs.unm.edu/~kmorel/documents/ColorMaps/index.html

It is somewhat similar to the cool colormap already included in matplotlib, but I've added the new colormap to matplotlib in the patch attached in case it is deemed fit to be included in the matplotlib source.

Regards,
Sameer

0001-added-coolwarm-colormap.patch (29.3 KB)

I came across this website where different colormaps have been compared
and the author has come up with an optimal colormap for data
visualization called the "cool-warm colormap".

http://www.cs.unm.edu/~kmorel/documents/ColorMaps/index.html

It is somewhat similar to the cool colormap already included in
matplotlib, but I've added the new colormap to matplotlib in the patch
attached in case it is deemed fit to be included in the matplotlib source.

Regards,
Sameer

Sameer,

We should include this, but I think the 257-entry version is overkill; it adds a big chunk to the _cm.py file, and I doubt it is visually distinguishable from the 33-entry version. Would you mind providing a patch for the latter? (Or better yet, the functions that generate the r,g,b values.)

Thank you.

Eric

···

On 07/18/2011 07:07 AM, Sameer Grover wrote:

------------------------------------------------------------------------------
AppSumo Presents a FREE Video for the SourceForge Community by Eric
Ries, the creator of the Lean Startup Methodology on "Lean Startup
Secrets Revealed." This video shows you how to validate your ideas,
optimize your ideas and identify your business strategy.
http://p.sf.net/sfu/appsumosfdev2dev

_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
matplotlib-devel List Signup and Options

Here's a pull request for the 33 entry map:
<https://github.com/matplotlib/matplotlib/pull/486&gt;

Christoph

···

On 9/13/2011 12:24 AM, Eric Firing wrote:

On 07/18/2011 07:07 AM, Sameer Grover wrote:

I came across this website where different colormaps have been compared
and the author has come up with an optimal colormap for data
visualization called the "cool-warm colormap".

http://www.cs.unm.edu/~kmorel/documents/ColorMaps/index.html

It is somewhat similar to the cool colormap already included in
matplotlib, but I've added the new colormap to matplotlib in the patch
attached in case it is deemed fit to be included in the matplotlib source.

Regards,
Sameer

Sameer,

We should include this, but I think the 257-entry version is overkill;
it adds a big chunk to the _cm.py file, and I doubt it is visually
distinguishable from the 33-entry version. Would you mind providing a
patch for the latter? (Or better yet, the functions that generate the
r,g,b values.)

Thank you.

Eric

Let me open a can of worms here…

I looked at the paper, and the goal was specifically to produce a good “default” colormap - not necessarily the best for any situation, but good overall and certainly better than the rainbow (‘jet’) colormap in most cases. (I agree with the author that jet is pretty terrible and tends to distort data.)

Should we switch to this as the default matplotlib colormap? I think it would be a clear improvement.

  • Nathaniel
···

On Sep 21, 2011 5:29 PM, “Christoph Gohlke” <cgohlke@…244…> wrote:

On 9/13/2011 12:24 AM, Eric Firing wrote:

On 07/18/2011 07:07 AM, Sameer Grover wrote:

I came across this website where different colormaps have been compared
and the author has come up with an optimal colormap for data
visualization called the “cool-warm colormap”.

http://www.cs.unm.edu/~kmorel/documents/ColorMaps/index.html

It is somewhat similar to the cool colormap already included in
matplotlib, but I’ve added the new colormap to matplotlib in the patch
attached in case it is deemed fit to be included in the matplotlib source.
We should include this, but I think the 257-entry version is overkill;
it adds a big chunk to the _cm.py file, and I doubt it is visually
distinguishable from the 33-entry version. Would you mind providing a
patch for the latter? (Or better yet, the functions that generate the
r,g,b values.)
Here’s a pull request for the 33 entry map:
<https://github.com/matplotlib/matplotlib/pull/486>

I have absolutely no clout here, but I’d definitely be in favor of changing the default colormap away from “jet”.

Personally, I’d prefer a two-tone colormap as the default (two-distinct tones at the limits with a gradient in-between—dubbed “sequential” in the paper) instead of a three-tone colormap (three-distinct tones—dubbed “diverging” in the paper). (I think this is a more common use case, and I think using a “diverging” colormap effectively requires setting vmin/vmax.) But really, (almost) anything is better than “jet”.

Don’t misunderstand: I know I can change the default colormap in my matplotlibrc file (and this is what I do). But 90% of people don’t bother to change the defaults. If changing this default in matplotlib prevents just 1 person from publishing a paper with a “jet” colormap, I think we’ll have made the world a better place. :wink:

-Tony

···

On Thu, Sep 22, 2011 at 5:16 PM, Nathaniel Smith <njs@…503…> wrote:

On Sep 21, 2011 5:29 PM, “Christoph Gohlke” <cgohlke@…244…> wrote:

On 9/13/2011 12:24 AM, Eric Firing wrote:

On 07/18/2011 07:07 AM, Sameer Grover wrote:

I came across this website where different colormaps have been compared
and the author has come up with an optimal colormap for data
visualization called the “cool-warm colormap”.

http://www.cs.unm.edu/~kmorel/documents/ColorMaps/index.html

It is somewhat similar to the cool colormap already included in
matplotlib, but I’ve added the new colormap to matplotlib in the patch
attached in case it is deemed fit to be included in the matplotlib source.
We should include this, but I think the 257-entry version is overkill;
it adds a big chunk to the _cm.py file, and I doubt it is visually
distinguishable from the 33-entry version. Would you mind providing a
patch for the latter? (Or better yet, the functions that generate the
r,g,b values.)
Here’s a pull request for the 33 entry map:
<https://github.com/matplotlib/matplotlib/pull/486>

Let me open a can of worms here…

I looked at the paper, and the goal was specifically to produce a good “default” colormap - not necessarily the best for any situation, but good overall and certainly better than the rainbow (‘jet’) colormap in most cases. (I agree with the author that jet is pretty terrible and tends to distort data.)

Should we switch to this as the default matplotlib colormap? I think it would be a clear improvement.

If it only prevents one person from publishing in “jet”, then we really stink in our jobs of promoting matplotlib…

Anyway, this is certainly is worthy of debate, but it certainly won’t happen for this release. We should be cutting RC tomorrow.

After the release, I encourage you guys to make your cases. Show us plots that have been in “jet” and show them as better in another colormap.

As a bit of a challenge to you all, I am not color-blind, but I do wear tinted glasses that make it difficult to tell the difference between darker blues and black, and sometimes greens and blues are hard to distinguish. Furthermore, as a radar meteorologist, I am very accustomed to the colormaps commonly used for radar reflectivies (and is similar to “jet”).

Of course, I am not the only one to convince (and others could certainly overrule me)…

Ben Root

···

On Thursday, September 22, 2011, Tony Yu <tsyu80@…149…> wrote:

On Thu, Sep 22, 2011 at 5:16 PM, Nathaniel Smith <njs@…1023…> wrote:

On Sep 21, 2011 5:29 PM, “Christoph Gohlke” <cgohlke@…244…> wrote:

On 9/13/2011 12:24 AM, Eric Firing wrote:

On 07/18/2011 07:07 AM, Sameer Grover wrote:

I came across this website where different colormaps have been compared
and the author has come up with an optimal colormap for data
visualization called the “cool-warm colormap”.

http://www.cs.unm.edu/~kmorel/documents/ColorMaps/index.html <http://www.cs.unm.edu/%7Ekmorel/documents/ColorMaps/index.html>

It is somewhat similar to the cool colormap already included in
matplotlib, but I’ve added the new colormap to matplotlib in the patch
attached in case it is deemed fit to be included in the matplotlib source.

We should include this, but I think the 257-entry version is overkill;
it adds a big chunk to the _cm.py file, and I doubt it is visually
distinguishable from the 33-entry version. Would you mind providing a

patch for the latter? (Or better yet, the functions that generate the
r,g,b values.)
Here’s a pull request for the 33 entry map:
<https://github.com/matplotlib/matplotlib/pull/486>

Let me open a can of worms here…

I looked at the paper, and the goal was specifically to produce a good “default” colormap - not necessarily the best for any situation, but good overall and certainly better than the rainbow (‘jet’) colormap in most cases. (I agree with the author that jet is pretty terrible and tends to distort data.)

Should we switch to this as the default matplotlib colormap? I think it would be a clear improvement.

I have absolutely no clout here, but I’d definitely be in favor of changing the default colormap away from “jet”.

Personally, I’d prefer a two-tone colormap as the default (two-distinct tones at the limits with a gradient in-between—dubbed “sequential” in the paper) instead of a three-tone colormap (three-distinct tones—dubbed “diverging” in the paper). (I think this is a more common use case, and I think using a “diverging” colormap effectively requires setting vmin/vmax.) But really, (almost) anything is better than “jet”.

Don’t misunderstand: I know I can change the default colormap in my matplotlibrc file (and this is what I do). But 90% of people don’t bother to change the defaults. If changing this default in matplotlib prevents just 1 person from publishing a paper with a “jet” colormap, I think we’ll have made the world a better place. :wink:

I looked at the paper, and the goal was specifically to produce a good
"default" colormap - not necessarily the best for any situation, but good
overall and certainly better than the rainbow ('jet') colormap in most
cases. (I agree with the author that jet is pretty terrible and tends to
distort data.)

Should we switch to this as the default matplotlib colormap? I think it
would be a clear improvement.

I have absolutely no clout here, but I'd definitely be in favor of
changing the default colormap away from "jet".

Personally, I'd prefer a two-tone colormap as the default (two-distinct
tones at the limits with a gradient in-between---dubbed "sequential" in the
paper) instead of a three-tone colormap (three-distinct tones---dubbed
"diverging" in the paper). (I think this is a more common use case, and I
think using a "diverging" colormap effectively requires setting vmin/vmax.)
But really, (almost) anything is better than "jet".

For those following along, the article is here:
http://www.cs.unm.edu/~kmorel/documents/ColorMaps/ColorMapsExpanded.pdf
The discussion about whether to use a "sequential" or "diverging" map
is in section 3.

I had the same gut reaction as you, but found the paper fairly
convincing. I'm used to diverging maps that really highlight the
center point, like matplotlib's RdBu colormap, and use them all the
time for data where the zero point really matters (and set vmin/vmax
appropriately, like you say). But this colormap is actually really
different from the ones I'm used to, because it's really designed
*not* to highlight the center point as being special. The clearest
example of this is Figure 8 in the paper -- the image on the left is
the one that you'd get from something like RdBu, and the one on the
right is what this colormap produces. And, like he says, it gives you
better detail than a sequential map could.

I actually *wouldn't* want to use this for images that I currently use
RdBu for. But I'm picky -- the map he suggests would still make a heck
of a better colormap for those images than jet does, and Rdbu *really*
isn't appropriate for general use.

Anyway, this is certainly is worthy of debate, but it certainly won't happen
for this release. We should be cutting RC tomorrow.

After the release, I encourage you guys to make your cases. Show us plots
that have been in "jet" and show them as better in another colormap.

Figure 16 in that paper (page 17) is a good start. In the examples
given, for both of the top two jet actively distorts the features of
the data. In row 1, it makes it look like the bars taper off as you
move towards the top of the image, which they don't (compare to the
greyscale image for reference). In row 2, it makes it look like the
"circles" vary in size across the image (which, again, they don't). In
the bottom two images, jet introduces apparent asymmetries that aren't
there: in row 3, you have these 5 apparent stripes of unequal width,
and the yellow is narrower than the cyan. In row 4, well, it's just
obviously terribly misleading. (This isn't surprising, since 'jet'
sweeps through the frequencies of visible light; the big band of
yellow in simulated deuteranope vision corresponds to where they're
missing one of the spectral sensors that most of us have.)

If you want more examples though I can certainly pull some out of my thesis :-).

As a bit of a challenge to you all, I am not color-blind, but I do wear
tinted glasses that make it difficult to tell the difference between darker
blues and black, and sometimes greens and blues are hard to distinguish.
Furthermore, as a radar meteorologist, I am very accustomed to the
colormaps commonly used for radar reflectivies (and is similar to "jet").

No colormap is going to be perfect for everyone, and maybe someone
else will pop up with a pointer to a map that's even better supported
than this one. I just think that jet has sufficiently manifest flaws
that it would be a great favor to science if we could switch to
*something* better as our default.

-- Nathaniel

···

On Thu, Sep 22, 2011 at 7:00 PM, Benjamin Root <ben.root@...553...> wrote:

On Thursday, September 22, 2011, Tony Yu <tsyu80@...149...> wrote:

On Thu, Sep 22, 2011 at 5:16 PM, Nathaniel Smith <njs@...503...> wrote:

On Thu, Sep 22, 2011 at 7:00 PM, Benjamin Root <ben.root@...553...> wrote:

Continuing with Nathaniel’s arguments, I think the article [1] you posted to the user list [2] recently makes a pretty good argument against using jet. (Although this isn’t really the main point of the article.)

Basically, it suggests that the jet colormap leads to bands of data (i.e. “incorrectly gives the impression that there are just a few values in the data”). This reduces visual contrast of data within those bands and inflates the contrast of data in adjacent bands.

[1] https://www.research.ibm.com/people/l/lloydt/color/color.HTM

[2] http://old.nabble.com/Visualizing-data-for-scientists-and-engineers-td32852270.html

As a personal pet peeve, it’s just not an intuitive color sequence to me. Sure, I know that the colors in “jet” more-or-less match the color wheel, but I have to stop and think about the fact that yellow is larger than green, for example. Plus it’s not at all intuitive that green is halfway in between blue and red (which are the extremes of the colormap).

I’m curious if there are any arguments for using jet/rainbow. I guess inertia/familiarity would be one. (But even though people are familiar with it, I doubt most would even know that green is midway between blue and red.) I guess it also magnifies the intensity range (since it uses 5-ish distinct colors instead of 2 or 3), but I doubt the noticeable range is that different than the coolwarm colormap, for example.

Best,
-Tony

P.S. Below is some simple code (mostly ripped from a gallery example) to compare colormaps. It’s pretty easy to the banding effect in the jet plot.

···

On Fri, Sep 23, 2011 at 1:27 AM, Nathaniel Smith <njs@…503…> wrote:

On Thu, Sep 22, 2011 at 7:00 PM, Benjamin Root <ben.root@…553…> wrote:

On Thursday, September 22, 2011, Tony Yu <tsyu80@…149…> wrote:

On Thu, Sep 22, 2011 at 5:16 PM, Nathaniel Smith <njs@…503…> wrote:

I looked at the paper, and the goal was specifically to produce a good

“default” colormap - not necessarily the best for any situation, but good

overall and certainly better than the rainbow (‘jet’) colormap in most

cases. (I agree with the author that jet is pretty terrible and tends to

distort data.)

Should we switch to this as the default matplotlib colormap? I think it

would be a clear improvement.

I have absolutely no clout here, but I’d definitely be in favor of

changing the default colormap away from “jet”.

Personally, I’d prefer a two-tone colormap as the default (two-distinct

tones at the limits with a gradient in-between—dubbed “sequential” in the

paper) instead of a three-tone colormap (three-distinct tones—dubbed

“diverging” in the paper). (I think this is a more common use case, and I

think using a “diverging” colormap effectively requires setting vmin/vmax.)

But really, (almost) anything is better than “jet”.

For those following along, the article is here:

http://www.cs.unm.edu/~kmorel/documents/ColorMaps/ColorMapsExpanded.pdf

The discussion about whether to use a “sequential” or “diverging” map

is in section 3.

I had the same gut reaction as you, but found the paper fairly

convincing. I’m used to diverging maps that really highlight the

center point, like matplotlib’s RdBu colormap, and use them all the

time for data where the zero point really matters (and set vmin/vmax

appropriately, like you say). But this colormap is actually really

different from the ones I’m used to, because it’s really designed

not to highlight the center point as being special. The clearest

example of this is Figure 8 in the paper – the image on the left is

the one that you’d get from something like RdBu, and the one on the

right is what this colormap produces. And, like he says, it gives you

better detail than a sequential map could.

I actually wouldn’t want to use this for images that I currently use

RdBu for. But I’m picky – the map he suggests would still make a heck

of a better colormap for those images than jet does, and Rdbu really

isn’t appropriate for general use.

On Thu, Sep 22, 2011 at 7:00 PM, Benjamin Root <ben.root@…553…> wrote:

Anyway, this is certainly is worthy of debate, but it certainly won’t happen

for this release. We should be cutting RC tomorrow.

After the release, I encourage you guys to make your cases. Show us plots

that have been in “jet” and show them as better in another colormap.

Figure 16 in that paper (page 17) is a good start. In the examples

given, for both of the top two jet actively distorts the features of

the data. In row 1, it makes it look like the bars taper off as you

move towards the top of the image, which they don’t (compare to the

greyscale image for reference). In row 2, it makes it look like the

“circles” vary in size across the image (which, again, they don’t). In

the bottom two images, jet introduces apparent asymmetries that aren’t

there: in row 3, you have these 5 apparent stripes of unequal width,

and the yellow is narrower than the cyan. In row 4, well, it’s just

obviously terribly misleading. (This isn’t surprising, since ‘jet’

sweeps through the frequencies of visible light; the big band of

yellow in simulated deuteranope vision corresponds to where they’re

missing one of the spectral sensors that most of us have.)

If you want more examples though I can certainly pull some out of my thesis :-).

As a bit of a challenge to you all, I am not color-blind, but I do wear

tinted glasses that make it difficult to tell the difference between darker

blues and black, and sometimes greens and blues are hard to distinguish.

Furthermore, as a radar meteorologist, I am very accustomed to the

colormaps commonly used for radar reflectivies (and is similar to “jet”).

No colormap is going to be perfect for everyone, and maybe someone

else will pop up with a pointer to a map that’s even better supported

than this one. I just think that jet has sufficiently manifest flaws

that it would be a great favor to science if we could switch to

something better as our default.

– Nathaniel

#----
mport numpy as np
import matplotlib.pyplot as plt

X,Y=np.mgrid[-5:5:0.05,-5:5:0.05]
Z=np.sqrt(X2+Y2)+np.sin(X2+Y2)

for cmap in (plt.cm.jet, plt.cm.coolwarm, plt.cm.BuPu, plt.cm.OrRd, plt.cm.gray):
plt.figure()
plt.imshow(Z, cmap=cmap)

plt.show()