colorbar tick decimal round

31 次查看(过去 30 天)
Hi,
I would like to round my colorbar values to 2 decimal places, is it possible?
Like in my figure, it has 4 dicimal places, 0.0372, I would like to display to 0.04 only.
I don't know how to do that :S
I try:
but failed.

采纳的回答

Azzi Abdelmalek
Azzi Abdelmalek 2016-5-2
plot(1:10)
h=colorbar
t=get(h,'Limits');
T=linspace(t(1),t(2),5)
set(h,'Ticks',T)
TL=arrayfun(@(x) sprintf('%.2f',x),T,'un',0)
set(h,'TickLabels',TL)

更多回答(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