MATLAB Answers

How to modify the showing colorbar range?

6 views (last 30 days)
zongxian on 27 Aug 2020
Commented: zongxian on 27 Aug 2020
External program will be created a image, for example
I will add a colorbar by my function, it simple
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).


Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 27 Aug 2020
Try this:
cmap = rand(10, 3)
% Now put color in block 10 into block 5
cmap(5) = cmap(10);
caxis([1, 6])

  1 Comment

zongxian on 27 Aug 2020
In this way, I can get the what I want, thank you.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!