How to change colorbar's color (in some particular value interval)?

811 ビュー (過去 30 日間)
chia hua
chia hua 2013 年 6 月 2 日
回答済み: Makarand 2018 年 4 月 27 日
Hi , I want to change colorbar's color in some particular value interval.
For example , I likes the jet colorbar , link is my figure, but I want to
let the value between -0.5~ 0.5 to become white color, how can I do this?
thank you much !!

採用された回答

Walter Roberson
Walter Roberson 2013 年 6 月 2 日
You need to create a new colormap that has the appropriate colors in the appropriate range.
It appears that you have your plot set up to automatically map your minimum data to the lowest color, and your maximum data to the highest color.
I estimate that the range you want to change is roughly 2/3 of the way to the highest color as your range looks like -4 to +2 .
So you need to use something like
newmap = jet; %starting map
ncol = size(newmap,1); %how big is it?
zpos = 1 + floor(2/3 * ncol); %2/3 of way through
newmap(zpos,:) = [1 1 1]; %set that position to white
colormap(newmap); %activate it
  3 件のコメント
chia hua
chia hua 2013 年 6 月 3 日
thank you!!!!

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

その他の回答 (2 件)

Amith Kamath
Amith Kamath 2013 年 6 月 2 日
You can manually change the colormap, using COLORMAPEDITOR:
Double click on the color markers below the spectrum displayed, and choose the color you want to display that range of data in, using the color picker.

Makarand
Makarand 2018 年 4 月 27 日
google Recolor_pcolor

Community Treasure Hunt

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

Start Hunting!

Translated by