How can I change the tick labels in a colorbar

12 ビュー (過去 30 日間)
Efstathios Kontolatis
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 件)

Community Treasure Hunt

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

Start Hunting!

Translated by