andrewRowlinson / mplsoccer

Football pitch plotting library for matplotlib
MIT License
405 stars 82 forks source link

Heatmap color coding #90

Closed enadol closed 1 year ago

enadol commented 1 year ago

Greetings! This is not an issue but maybe just a comment or quick question. On the heatmap examples, one uses brighter colors for high values...

image

...whereas the next features brighter colors for lower values.

image

Is there a contradicton, or maybe I'm missing something here? Normally I would asume that, in a heatmap, "darker" always means "higher". Thanks in advance and congratulations for mplsoccer, a very useful tool.

andrewRowlinson commented 1 year ago

Yup, the first is called hot, and the 'hotter' areas are lighter. I do tend to use darker = larger number if I am using a light background. On dark backgrounds you might want the opposite. All of the matplotlib cmaps can actually be reversed with _r appended to the name.

However, there's no fixed rule. Sometimes you want three colours like this excellent example: https://twitter.com/jonollington/status/1677590743249035264?s=20.

I recommend this great article on colour: https://blog.datawrapper.de/beautifulcolors/. Colour is really important for making great viz!

enadol commented 1 year ago

Oh, I totally get it. It makes sense with the dark background. Many thanks also for the articles! Keep it up!