How do i create a colormap that seperates ranges between exact values?

1 回表示 (過去 30 日間)
Neta Stern
Neta Stern 2017 年 7 月 13 日
コメント済み: Adam 2017 年 8 月 4 日
I'm trying to create a colormap for a plot that contains 3 colors. Values equal or under a specific value (say 0.73) should be orange, and values over a specific value (say 1.2) should be blue. All values between should be white. The top and bottom thresholds (0.73, 1.2, For example) are determined at run time. Anyone knows how to do it? Thanks.
  1 件のコメント
Adam
Adam 2017 年 8 月 4 日
If it is that simple a scenario you'd be better off creating a true RGB image by explicitly mapping your data to colours. A colourmap is a discretised set of colourbins, usually 256 or 512 of them and your data gets mapped implicitly onto that. If you have floating point data then you cannot provide a colourmap with an explicit colour change at an arbitrarily defined value because of the descretisation.

サインインしてコメントする。

回答 (1 件)

Sudharsana Iyengar
Sudharsana Iyengar 2017 年 8 月 4 日
Try something like this, custom colormap with 5 colors.
mymap = [0 0 0 1 0 0 0 1 0 0 0 1 1 1 1];
surf(peaks) %This is default peaks program in MATLAB. you can use it for ur code also. colormap(mymap)

カテゴリ

Help Center および File ExchangeColormaps についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by