I make a graphical R package which includes scatterplots as heatmaps. These plots show the data points of two variables on the x and y axis while colouring them with the values of a third variable. What colour scales are best for this purpose? The plot background is white.

What I've tried

For R there is an omnipresent colour package called RColorBrewer. After reading a few blogs about heatplots, I started experimenting with RColorBrewer palettes but I find them just unsuitable in my situation, because they always have very light colours at some point (in case of sequential colours at the top of the scale and in case of diverging colours in the middle). See here two examples, first the sequential scale “Blues” and second the diverging scale “RdBu”:



The problem is obviously that this light colours seem almost invisible on a white background. Therefore, I tried a scale that goes from blue to red. See here:

My scale

My problem is that RColorBrewer is so omnipresent for R and it does not include any “pure” colour scales like from blue to red. Therefore, I feel like doing something wrong when I use my blue to red scale. Are there any clear objections why I should not use this? Are there other scales that are better in my context?

  • 1
    I think this is purely a matter of opinion.
    – Scott
    Feb 18, 2022 at 13:10
  • 1
    Data visualization is difficult. What is the essential thing that you wanted to make noticeable so well that one could see it's worth extracting quantitatively from your data series? The only easy to spot trend or relation (without knowing the context) is the faded line-like zone in your 2nd image. That means: if X and Y have approximately relationship Y=-X the 3rd value is near zero. If that relation happened to be the interesting one you succeeded pretty well to visualize it.
    – user82991
    Feb 18, 2022 at 14:38
  • @user287001 This is just dummy data for illustration. The colouring variable is simply x+y. I have no clue about design etc. and there is so much to read about colour theory. If it's purely a matter of opinion as Scott suggests I would use my blue to red. Do you agree on that statement?
    – Ingo Pingo
    Feb 18, 2022 at 20:21
  • It's not a matter of opinion. The 2nd version succeeded to visualize perfectly that the 3rd variable (which you just revealed to be X+Y) approaches zero when Y approaches -X. If you do not have any as obvious relations which should be spotted as patterns you of course can approach the problem from artist's viewpoint. But in that case I do not have any idea why there should be different colors. Have either other background than white if you have white dots or change white dot color for ex to green. If you are not going to visualize your data but create tools, then research what's wanted to see.
    – user82991
    Feb 19, 2022 at 9:52


Your Answer

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

Browse other questions tagged or ask your own question.