How to use two colormaps in one imagesc plot?

조회 수: 2 (최근 30일)
xw wang
xw wang 2020년 12월 2일
댓글: Ameer Hamza 2020년 12월 2일
I got a correlation map 50*50 with the data range [-0.8,1], I would like to plot the map using imagesc, and set the colormap based on the value range of each pixel, e.g for value >0 using 'hot' and for value<=0 using 'cool'. Is there a simple way to achieve this? Thanks in advance!

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 12월 2일
You can create a new colormap based on the proportion of the individual colormap
imagesc(M);
colorbar();
caxis([-0.8 1]);
cmap = [cool(80); hot(100)];
colormap(cmap);
  댓글 수: 4
xw wang
xw wang 2020년 12월 2일
Great, thanks, this seems a good way solving my problem, thanks a lot
Ameer Hamza
Ameer Hamza 2020년 12월 2일
I am glad to be of help!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Blue에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by