Is it possible to define colormap ranges or merge colormaps?

조회 수: 42 (최근 30일)
lstr
lstr 2022년 8월 25일
댓글: lstr 2022년 8월 25일
I am creating a heat map using imagesc with data in [0 100]. I need to emphasize two data ranges as distinct, say [0 5] shades of red and [5 100] colors that are not red.
I'm a proficient MATLAB user/googler generally, but am not sure what vocabulary to use when searching. Any advice - either tips on how to accomplish this or terms to google - would be welcome!
Thanks!

채택된 답변

Chad Greene
Chad Greene 2022년 8월 25일
Try concatenating colormaps, like this. Below I'm using my cmocean colormaps, which are available on File Exchange, but you can concatenate any RGB arrays.
% Some data
Z = abs(peaks(500));
Z = 100*Z/max(Z(:)); % scaled 0 to 100
figure
imagesc(Z)
cb = colorbar;
% Two colormaps:
col1 = cmocean('amp',6); % 6 shades of red
col2 = parula(95); % 95 shades of parula
% Concatenate colormaps:
col = cat(1,col1,col2);
colormap(col)
  댓글 수: 1
lstr
lstr 2022년 8월 25일
Thank you so much! This was exactlly what I was looking for!

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

추가 답변 (0개)

카테고리

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

태그

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by