Dear biostars community ! After spending few days looking on the net I finally decide to post my question here.
I wanted to create a heatmap but using three color depending on the ratio between three values. This is an example :
A (0.2), B (0.5) and C (0.3)
for example the A is blue, the B is red and the C is green (see the triangle). for that particular point which is the resulting color (it must be more blue > > green > red). I really don't know where to start and if there is an automatic way to do it in R for example.
Thanks for advance for your help
From a purley data-viz point of view, this is probably not a good idea. True colour is not a three dimensional thing, it's only 1 dimension, you just happen to have 3 receptors in your face. This would be OK if it wasn't for the fact that the receptors overlap in what they pick up, so they are non-independant:
There is a second dimension your eyes can pick up, light intensity, although since the eyes have a non-linear response to the amount of light coming in and the amount of light perceived, depending on colour, this makes using light intensity quite difficult. For sure, if you use RGB, this non-linear correction will not be done. The HCL colour palette however is designed to make this correction, and it's built into R. (http://hclwizard.org/why-hcl/) (https://stat.ethz.ch/R-manual/R-devel/library/grDevices/html/hcl.html)
But even HCL provides you with 3 dials to fiddle with: Hue, Chroma and Luminosity. chroma and hue are not perceived independently, so set the chroma, then use only H and L, or set the hue and use only C and L.
If you really have three dimensions that are totally separate, you're better off using 3D space. If you were plotting these three colours in 2D space before, consider swapping everything around. Plot a scatter based on the data you're using for colour, then colour the scatter in using HCL with the data you previously used for X and Y.
There's always a bit too much made out of the overlap in photoreceptor sensitivity. The brain is able to handle that just fine. The bigger issue is red-green color blind individuals...
Oh yeah, I must admit, i'm pretty bad at remembering to take that into consideration. All the more reason to avoid colour if possible -_-;