change the scale of colorbar

23 views (last 30 days)
Zhihan Wu
Zhihan Wu on 8 Aug 2022
Commented: Zhihan Wu on 13 Aug 2022
I wanna change the scale of the color bar. of the image below to [0 0.02]
I tried many method, like shown below
c = colorbar;
%c.Limits = [0 0.02]
%set(c,'ylim',[0 0.02])
but the outcome is like this. The colorbar become the same color. only the range changes instead of the scale. I want the colorbar to be different from 0 to 0.02. How should I do that? Thanks for answering!

Accepted Answer

Karim on 8 Aug 2022
you can use the caxis command, simply add caxis( [0 0.02]) below the colorbar command.
c = colorbar;
caxis([0 0.2])
Zhihan Wu
Zhihan Wu on 13 Aug 2022
I think my problem is solved. Thank you all!

Sign in to comment.

More Answers (0)


Find more on Colormaps in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!