2

Now the colorbar is automatically set by the data distribution in the heatmap. I'd like to change the three colours for three specific ranges in the colorbar manually, and re-display the data distribution.

[0-1500)--blue;
[1500-3000) -- green;
[3000-8000] -- red;

I followed this post: How to create a custom colormap programmatically?

but don't know how to apply to my heat map (please see the image below)

https://i.stack.imgur.com/wIlql.jpg

Code for generating the image:

a =  xlsread('data.xlsx', 'A1:A480'); a = reshape(a,16,30); rgb = colormap([1 0 0; 0 1 0; 0 0 1]);
heatmap(a, x, y, '%0.2f', 'Colormap', flipud(rgb), 'NaNColor', [1 1 1], ... 'ShowAllTicks', 45, 'GridLines', ':'); 

So my question is how to re-display the data distribution. For example, I want to put some data that was in the green range [2700-5200] to the new red range [3000-8000]. Could anyone help me on this, please?

Community
  • 1
  • 1
ruthot
  • 31
  • 2

0 Answers0