I'm doing maps of how much solar energy is received by the ground surface over Europe, using matplotlib. So I'm obviously plotting sequential data. I'm doing a filled contour map.

I have monthly as well as yearly maps for ~35 years and since my aim is to be able to visually compare between all of them, I want to devise a consistent colormap to use. What I want to do is map a particular colour to a range within the range 0-420W/m2. So for example if a particular hue of red is for 300-400W/m2 and my map doesn't contain data with that magnitude, this colour wouldn't appear on that map.

My two questions are how many colours to have in my colormap and which colours to choose?

In terms of how many colours I guess the answer is "enough to cover the variability in the data". Looking at some stuff online e.g. here I've figured I'd use 15 bins so every 28th value'd be represented by a different colour. However even if I were to copy the colours from the above map I:

  1. Don't know what they are and how to find out. I'm not very good at telling colours apart (and slightly red-green colourblind).
  2. Don't know if they are at all appropriate.

I guess since I'm plotting something to do with "heat" and "solar" I'd go for colours in the red range at the maximums and probably blues in the minimums. I don't know how to choose the different hues and what goes in-between.

Here's what I have so far with the default matplotlib "jet" scheme (a rainbow colormap). I've been told rainbows are very bad fore sequential data so I'm not keen on using it. Also, it has 50 contour levels but I'll probably end up using less. All of the plots below however segment the colours in each map for each period separately (they're not standardized across maps). I'm plotting the same period on these below so they look mostly the same but there's a wide difference if I were to plot the month of July e.g. as the range of values'd be ~100-400W/m2

filled contour 50 levels rainbow colormap

I've also tried using the Cynthia Brewer Red09 scheme which has 9 discrete levels:

CBrewer Reds 09 9 levels filled contour

I tried extending the Cbrewer Reds 09 scheme into a linear segmented colourmap so that it can accommodate 50 contour levels but I just ended up smudging up the variability in the map:

50 levels extended Cbrewer Reds09

Finally I tried a custom scheme that has 19 levels. The RGBs look like this:

red = numpy.array([0, 0, 221, 239, 229, 217, 239, 234, 228, 222, 205, 196, 161, 137, 116, 89, 77, 60, 51]) / 256.
green = numpy.array([16, 217, 242, 243, 235, 225, 190, 160, 128, 87, 72, 59, 33, 21, 29, 30, 30, 29, 26]) / 256.
blue = numpy.array([255, 255, 243, 169, 99, 51, 63, 37, 39, 21, 27, 23, 22, 26, 29, 28, 27, 25, 22]) / 256.

The map:

custom scheme 19 levels filled contour

I want to stress that I don't want anybody to write code for me, I'll figure that out myself, I want advise on what colours to choose and their colour codes or something so that I know what they are and implement them :). Does that seem reasonable? Hopefully someone can help!

  • The custom map looks good except for the green tint in the yellows and the light brown could be lighter in color so the dark brown is more visible.
    – joojaa
    Aug 13, 2014 at 9:57
  • Stupid question (again) but which channels would I need to lower for that? Aug 13, 2014 at 10:41
  • Please consider upvoting/following the StackExchange Color Theory site: area51.stackexchange.com/proposals/110687/color-theory
    – Adi Shavit
    Jun 22, 2017 at 8:15

1 Answer 1


I think most people have found themself asking the same question. I know I have. Generally I have accepted that every set of observations that exist within a quantitative and continuous range should be visualised using two-color sequential colormaps, that is one color gradually turning into its complementary color over the given range of values. If you are color blind you can use the color harmony wheel in order to pick out complementaries.

Then you are saying that you want your range of values to fill out the range of colors, which is usually not a problem unless you start pairing colors and values (you should never do this unless you have qualitative data). Most plotting libraries take care of this issue for you. Python's Matplotlib provides an optional cmap agument in their plotting methods, where you can pick any predefined or customized colormap. Using this, you will never have the problem of your colors not mapping correctly to your values.

In special cases you can have values where the standard deviation increases for higher values. This is a problem for color mapping that is solved with e.g. a log transform (exponential increase) or a root transform (potential increase). The invese may also be the problem in which case you do the opposite transforms.

On a final note it should be stressed that there are no generally agreed upon "best practices" when it comes to color mapping in data visualisation. There is only taste.

  • 1
    Hi Ulf, welcome to GDSE and thanks for your answer. If you have any questions, please see the help center or ping one of us in Graphic Design Chat once your reputation is sufficient (20). Keep contributing and enjoy the site!
    – Vincent
    May 8, 2015 at 9:54
  • 1
    Thanks for the warm welcome. May I ask, is this an automated message?
    – Ulf Aslak
    May 8, 2015 at 18:11
  • It is not, though it is a template. Welcome!
    – Vincent
    May 8, 2015 at 18:36
  • 3
    Lol Vincent. He got you!. Wellcome Ulf.
    – Rafael
    Aug 6, 2015 at 14:20
  • Please consider upvoting/following the StackExchange Color Theory site: area51.stackexchange.com/proposals/110687/color-theory
    – Adi Shavit
    Jun 22, 2017 at 8:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.