: What colormap to choose? 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
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:
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).
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
I've also tried using the Cynthia Brewer Red09 scheme which has 9 discrete levels:
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:
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:
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!
More posts by @Hamaas979
1 Comments
Sorted by latest first Latest Oldest Best
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.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.