Heatmap a Matrix of values

6 views (last 30 days)
Maurizio Cimino
Maurizio Cimino on 20 May 2019
Edited: Adam on 20 May 2019
Hello,
i have a matrix of pixels A. I would like to create a heatmap on A; i mean that i want colour all the pixels in the matrix of a color. The pixels with highest values should have the darkest color, the pixels with lowest values should have a lighter colour. For example, i would use the color red, then all the biggest values in my matrix should be colored of dark red, all the lowest values should be colored of light red, so i'm interested in an interval of the colour.
Do you know how can i do that?
Thank you very much for your help.
  4 Comments
Maurizio Cimino
Maurizio Cimino on 20 May 2019
Do you know if there's a way to color of blue (for example) just the negative values?
Adam
Adam on 20 May 2019
Edited: Adam on 20 May 2019
You can edit colourmaps in a variety of ways, but you also need to ensure you set the colourmap axis range specifically for something like that.
doc caxis
So, for example, you could use half heat map and the other half just entirely blue by doing something like:
myColourmap = [ repmat( [0 0 1], 128, 1 ); hot(128) ];
then use this colourmap:
colormap( myColourmap );
instead of 'hot' above. But then you must setup a symmetric colour axis range in order for your data to sit correctly within the colourmap e.g.
caxis( hAxes, [-1 1] * max( abs( myData ) ) )

Sign in to comment.

Answers (0)

Categories

Find more on Data Distribution Plots in Help Center and File Exchange

Products


Release

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!