How to modify the showing colorbar range?

7 ビュー (過去 30 日間)
zongxian
zongxian 2020 年 8 月 27 日
コメント済み: zongxian 2020 年 8 月 27 日
External program will be created a image, for example
image(rand(100,100)*10)
colormap(rand(10,3))
I will add a colorbar by my function, it simple
colorbar
Now I only show part of the colorbar by colorbar('Ylim',[1,6]). But I want to change the color of the 5th color block, let it same as the last color block. (the 5th color block of the right image should be changed to the last color (of left image)).
No need to care about the Ticks of the 5th color block, (maybe showing like '>5', or any other string).

採用された回答

Image Analyst
Image Analyst 2020 年 8 月 27 日
Try this:
image(rand(100,100)*10)
cmap = rand(10, 3)
colormap(cmap)
% Now put color in block 10 into block 5
cmap(5) = cmap(10);
colormap(cmap);
caxis([1, 6])
  1 件のコメント
zongxian
zongxian 2020 年 8 月 27 日
In this way, I can get the what I want, thank you.

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

その他の回答 (0 件)

カテゴリ

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