MATLAB: Colorbar tick labels – set decimals places

colorbarcolormaptick

Hi,
I've created a filled contour map with a colorbar and want to set the tick labels all to 2 decimal places, i.e. show 0.05 0.10 0.15 0.20 etc not 0.05 0.1 0.15 0.2 etc
is there an easy way to make this happen, as even when I specify the tick values to two deicmal places it gets shortened
Thanks

Best Answer

Here's an example:
figure
[c, h] = contour(peaks/30);
clabel(c, h)
cb = colorbar
set(cb,'YTickLabel',{'-0.20';'-0.15';'-0.10';'-0.05';' 0.00';'0.05 ';' 0.10';' 0.15';' 0.20';' 0.25';})