How can I change the tick labels in a colorbar

조회 수: 1 (최근 30일)
Efstathios Kontolatis
Efstathios Kontolatis 2017년 2월 10일
댓글: Efstathios Kontolatis 2017년 2월 10일
I have some images that contain probability data. Thus, the colorbar is [0 1]. However, when I plot them I want the colorbar tick labels to be [0% 100%](without changing the image). Is there a way to do so?

채택된 답변

Adam
Adam 2017년 2월 10일
편집: Adam 2017년 2월 10일
figure; hAxes = gca;
imagesc( hAxes, rand( 25 ) );
hc = colorbar( hAxes );
hc.TickLabels = arrayfun( @num2str, hc.Ticks * 100, 'UniformOutput', false );
  댓글 수: 3
Adam
Adam 2017년 2월 10일
hc.TickLabels = arrayfun( @(x) [num2str(x) '%'], hc.Ticks * 100, 'UniformOutput', false );
Efstathios Kontolatis
Efstathios Kontolatis 2017년 2월 10일
Thank you very much that works fine

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Colorbar에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by