Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the algorithm to create colors for a heatmap?

Assuming values are normalized from 0 to 1, what is the algoritm to get a color to create a heatmap like this?

1 is red, .5 is green, 0 is dark blue.

Working in RMagick / ImageMagick.

heatmap

like image 418
B Seven Avatar asked Oct 13 '12 18:10

B Seven


People also ask

How do you set the color on a heatmap?

You can customize the colors in your heatmap with the cmap parameter of the heatmap() function in seaborn. The following examples show the appearences of different sequential color palettes.

What do the colors in a heatmap mean?

Reading a heat map depends on which data is represented on that particular map. Bear in mind that warmer colors indicate higher values and colder colors indicate lower values. Red is the warmest color and purple is the coldest in these maps. You need to analyze colors and understand the intensity of the map.

How are heat maps generated?

Heatmaps can be created by hand, though modern heatmaps are generally created using specialized heatmapping software. Heatmaps have been used in some form, since the late 1800s, when Toussaint Loua used a shading map to visualize social demographic changes across Paris.


1 Answers

Here is a JavaScript code snippet to generate CSS hsl color code from [0, 1] value

function heatMapColorforValue(value){   var h = (1.0 - value) * 240   return "hsl(" + h + ", 100%, 50%)"; } 

This algorithm is based on the 5 color heatmap,

In this algorithm, the colors corresponding with values are

0    : blue   (hsl(240, 100%, 50%)) 0.25 : cyan   (hsl(180, 100%, 50%)) 0.5  : green  (hsl(120, 100%, 50%)) 0.75 : yellow (hsl(60, 100%, 50%)) 1    : red    (hsl(0, 100%, 50%)) 

So simple!

like image 105
Mekajiki Avatar answered Oct 05 '22 17:10

Mekajiki