MATLAB Answers

How change the colormap on heatmap??

58 views (last 30 days)
Yuliano Moscoso Yarin
Yuliano Moscoso Yarin on 5 Nov 2019
Answered: Steven Lord on 5 Nov 2019
Hello ,
I'm trying to change the colormap on my heatmap, I'm using right now the '"money" color but I'm want to be blue one, I tried many options without any luck. Any help will be appreciate.


Jess Lovering
Jess Lovering on 5 Nov 2019
Here is a helpful resource for this question. You can make and save any colormap you want throught the colormap editor:
Adam Danz
Adam Danz on 5 Nov 2019
This has been answered many times before. Here's a list of heatmap + colormap related Question-answers.

Sign in to comment.

Answers (1)

Steven Lord
Steven Lord on 5 Nov 2019
Change the Colormap property of the heatmap, either when you construct the heatmap:
h = heatmap(magic(5), 'Colormap', copper);
or afterwards.
h.Colormap = flag;
If none of the predefined colormaps are suitable for your application you can build your own as an M-by-3 matrix, either manually or using the colormapeditor as per Jessica Lovering's comment.
h.Colormap = repmat(linspace(0, 1, 25).', 1, 3);


Sign in to comment.

Sign in to answer this question.