Use the full range of colours in a colourbar
2 views (last 30 days)
Antonis Asiminas on 7 May 2018
Hi everyone and thank you in advance for your time. I've a question related to colour bar use. I'm plotting several correlation matrices using Heatmap. The values technically range from 1 to -1 although it depends on the matrix I'm plotting. Some could be from 1 to -0,1 never reaching very negative values). I choose the preferred colourbar (jet). Based on what I understand, when I'm plotting these matrices separatelly Matlab should take the min value of my matrix and assign it to the deep blue end of the bar and then do the equivalent for the max value assigning it to the deep red, then all the other values will fall somewhere in between. This in not what is happening though. It seems that the colour on my heatmap correspond to a fixed range (-1 for deep blue and 1 for deep red). This is useful when comparing between the different heatmaps but I would like to set the range of colour for every heatmap when I'm plotting them individually and display it next to my heat meatrix.
Thank you again.
Arthur Goldsipe on 7 May 2018
You are using the HeatMap function from the Bioinformatics Toolbox. By default, this function uses a symmetric colormap. In the case of your data, you would only see blue colors if you also had negative values near -1. If you don't want this symmetric coloring, set the Symmetric option to false. For example, try the following code: HeatMap(linspace(-0.1,1),'ColorMap','jet','Symmetric',false)