MATLAB: Does the colorbar in MATLAB 7.0 (R14) not extend all the way to the extent of the color axis

caxiscolorbarMATLABsurfticksylim;

When I execute the following code:
figure;
surf(peaks);
caxis([-10 10]);
colorbar;
I notice that there are no labels for the -10 and 10 ticks on the colorbar.

Best Answer

This bug has been fixed in MATLAB 7.0.4 (R14SP2). For previous releases, read the following for possible workarounds:
There is a bug in MATLAB 7.0 (R14) when using a colorbar on a figure.
To work around this issue, manually set the axis limits to the desired range. For example:
figure;
surf(peaks);
caxis([-10 10]);
cb1 = colorbar;
set(cb1, 'ylim', caxis);