29

I often produce figures with a surface with quantitative data attached, plotted in a heatmap type style (see figure).

Previously, I've used the default matlab colormap for this but I recently noticed how terrible this is when printed black & white, the high and low colors appear the same.

Is there a better/recommended colormap I should use to improve clarity when printed.

Related: Are there good reasons to avoid using color in research papers?

enter image description here

6
  • 1
    Does Matlab have grayscale heatmaps? That would be probably what you're looking for, since it would plot from dark to light rather than based on brightness.
    – Compass
    Dec 15, 2014 at 15:29
  • 9
    The new default colormap in (yuck) matlab has exactly this property - see this post
    – ff524
    Dec 15, 2014 at 15:30
  • You can use the colormaps with a monotonic lightness increase like gray, summer, bone etc. I personally only use jet when I have data equally spread in negative and positive around 0 (e.g. phase data).
    – Cape Code
    Dec 15, 2014 at 15:50
  • 2
    Edward Tufte's classic The Visual Display of Quantitative Information covers this IIRC. Well worth reading.
    – A E
    Dec 15, 2014 at 15:54
  • 1
    Obviously I didn't realise parula existed. I should probably upgrade my matlab installation. If someone can give a good explanation of why it is better I will probably accept that. If no one does I might have a stab at it in a couple of days.
    – nivag
    Dec 15, 2014 at 17:01

7 Answers 7

27

UPDATE:2

Use perceptually uniform color-maps when possible. I suggest to use this nice toolbox in Matlab (colorBrewer) or to use the new perceptually uniform colormaps from python matplotlib (also available in Matlab).

Matplotlib's new colormaps look like this:

enter image description here

UPDATE:

If you use Matlab, and you have access to Matlab R2014b or newer, use the default colormap: parula. They designed it so it is a good colormap, not only for b&w printing but also for correct data visualization (i.e. it doesn't add features due to the choice of colour, as jet does)

Explanation: http://blogs.mathworks.com/steve/2014/10/20/a-new-colormap-for-matlab-part-2-troubles-with-rainbows/

Parula looks like this:

enter image description here enter image description here

Original answer

Use the "hot" colormap. If you use Matlab this is one of the built colormaps. I believe than in numpy and other languages you also have this colormap included.

You can see in the image below, how the commonly used "jet" , the "hot" and a "gray" colormap are seen in grayscale. It can be seen that the "hot" colormap is quite good both in colour and grayscale.

enter image description here

1
  • 3
    For clarity: in the figure at the top, the two leftmost panels are jet (terrible) and parula (matlab's new default); the other four panels are the new colormaps released for matplotlib that have superior visual properties (they're perceptually uniform in both color and black-and-white). Parula is a fine colormap, but somewhat less optimal in its native form (but then, I would say that ;-)); and it doesn't even attempt to be perceptually uniform when printed in black-and-white (see bids.github.io/colormap for analyses). Pretty much anything is better than jet. Jan 26, 2016 at 10:59
10

Thanks to those who pointed out that Parula is the new default Matlab colormap and solves this problem nicely. I will give a more general explanation of why this problem arises. A very good series of articles about colormaps can be found here.

I'll consider the colormap as a series of colours in Lab space, for reasons which will become clear shortly. In Lab space L represents the colour's lightness and a and b give the colour. Therefore we can view converting to greyscale as taking only the L component (with a=b=0). Therefore to convert well into greyscale our colormap should be monotonic in L and ideally approximately linear.

The 3D color inspector plugin for imageJ provides a handy tool to visualise the colormaps in Lab space. Looking at the Jet colormap (the old Matlab default) in this way the problem becomes clear. Jet is not monotonic in lightness and approaches maximum lightness somewhere in the green/yellow range. Therefore, when converted to greyscale the two ends of the map appear dark while the centre is light coloured.

Compare this to the parula colormap, which is monotonic in lightness. If you do further analysis you can also show that it is reasonably linear in lightness. The conversion to greyscale will therefore be pretty good.

There are many other colormaps which also have this property of monotonic lightness, in particular most monotone maps. However, it is also advantageous to maximise the distance between colours in Lab space to increase clarity when viewing in colour. Monochrome maps are relatively weak in this respect as they have a much more limited range of ab values than rainbow type maps.

enter image description here

2
  • 1
    Perceptually uniform colormaps in Matlab: uk.mathworks.com/matlabcentral/fileexchange/… Jul 30, 2015 at 16:35
  • I would +10 if I could. Remember that while gray printing is one thing, printing on colour (especially laser) printers is another. These printers are known for giving "hard" pictures -- with high saturation and low quality on luminosity; basically, you're only left with hue, and parula seems to be quite good in this.
    – yo'
    Jan 22, 2016 at 18:04
9

I think the default colour map is not that good for most cases, since having essentially four different colours can make it look different than what it is. A very clear example of what I say (and a bunch of rants why one should not use MATLAB).

enter image description here

See the yellow stripe? It is essentially an artefact of jet, and not a property of the data (more on the post).

For a better option, I would suggest Color Brewer, that can suggest you different colour schemes safe for black and white, colourblind friendly, etc.

7
  • 1
    As per ff524's comment, jet is no longer the default colourmap of Matlab (hurrah!) as of R2014b. Unless there's good reason to use another map, the new default parula looks great.
    – Moriarty
    Dec 15, 2014 at 16:27
  • 1
    Isn't the question about downgrading color colormaps to black and white? Can you update your answer to address this issue?
    – Bill Barth
    Dec 15, 2014 at 16:52
  • 10
    Suggesting to abandon Matlab because you dont like the default colormap is like not going to an Italian restaurant because you dont like pepper. Dec 15, 2014 at 18:31
  • 1
    @AnderBiguri that is not my blog, nor my opinions, but if you read the rest, it is like not going to an Italian restaurant because you don't like pasta, pizza bread, tomato...
    – Davidmh
    Dec 15, 2014 at 19:46
  • 6
    I can't read your "bunch of rants", your blog is login-walled. Jan 22, 2016 at 7:21
7

For a free (and maybe nicer?) alternative to Parula use Python matplotlib's Viridis. See this fascinating talk for its development:

Virid

2
4

The figure examples pretty much says it all, if you look at how the different hues are translated into a grey scale you will see that a two-tone scale going from a colour rendering dark in B/W to a colour rendering light in B/W would the solution. But, this is not much different from using a monochrome scale from light to dark since the boundary when colour one and colour two may only be clearly visible in colour and not in B/W.

There is thus reasons for trying to solve graphics in B/W until it is clearly impossible to solve what you want to visualize in any other form than with multiple colours. Back in time, one would always argue that copying colour papers would result in poor B/W copies is not so relevant anymore since it is possible to use colour copiers, a combination of scanning and printing in colour or downloading a pdf to print in colour.

So while colour is all around us there are still reasons to consider B/W as a primary choice. Colour blindness (as mentioned in another reply) is one such reason. Plotting software, be it rudimentary as Excel or more advanced as Matlab forces colour in cases where it is not necessary.

2

The chosen answer mentions the 'hot' colormap, but I tend to find this is often too bright. I find that the 'cold' colormap (top) often works better.

enter image description here

Also no one has mentioned monochrome colormaps (bottom), which are just like grayscale but without the gray. These give you the ability to pick any hue you like, which can be helpful for making the colormap fit in with other elements of a presentation/poster/report etc. And you're guaranteed they'll remain meaningful in black and white.

I give more detail in this post

0

I could write an answer to your question but why rewriting when the exact problem you describe and its solution have been beautifully explained in this webpage

https://cran.r-project.org/web/packages/viridis/vignettes/intro-to-viridis.html

In there you will find the following colour scales:

  • Viridis
  • Magma
  • Plasma
  • Inferno
  • Cividis
4
  • 3
    While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review
    – Flyto
    May 11, 2018 at 6:57
  • Welcome to Academia.SE! I agree with @Flyto. Would you please expand your answer to be independent of the link? Otherwise it is likely to be down voted or removed. Thank you!
    – The Doctor
    May 11, 2018 at 12:43
  • Hello. Apologies if it sounds a bit dry, but 'the essential parts of the answer' you would like me to include are long and wide, and explaining them here would take me a long time - which I wish I had. My intention is to provide anyone who read this with a piece of information which may lead them to read a very compelling answer written somewhere else. If you are interested in the subject, and the link is dead, the chances are you will google the list of colour scales I mentioned and find a replica of the 'dead link' in another webpage.
    – jberrio
    May 14, 2018 at 4:50
  • If you still consider this an 'unacceptable answer', then my answer can be removed. People who could benefit of this piece of information may not come across it though. My only intention is to share the info, because it helped me back in time. Hope this helps.
    – jberrio
    May 14, 2018 at 4:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .