change the scale of colorbar

조회 수: 15(최근 30일)
Zhihan Wu
Zhihan Wu 2022년 8월 8일
댓글: Zhihan Wu 2022년 8월 13일
I wanna change the scale of the color bar. of the image below to [0 0.02]
I tried many method, like shown below
image(x,y,D')
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!

채택된 답변

Karim
Karim 2022년 8월 8일
you can use the caxis command, simply add caxis( [0 0.02]) below the colorbar command.
figure
surf(rand(10,10))
c = colorbar;
caxis([0 0.2])
  댓글 수: 3
Zhihan Wu
Zhihan Wu 2022년 8월 13일
I think my problem is solved. Thank you all!

댓글을 달려면 로그인하십시오.

추가 답변(0개)

태그

Community Treasure Hunt

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

Start Hunting!

Translated by