I want to manually set my colorbar's tick labels and its position horizontal. For example:
Min=0.8;
Max=12;
h = colorbar('horiz');
set(h,'location','southoutside')
set(h,'XTickLabel',{num2str(Min),'mm' ,num2str(Max)})
However, the above code repeats the tick labels label. How can I set number of tick manually?
I want my colorbar to appear something like the following:
****----------------**** //colorbar
min [mm] max
You can set the locations of your ticks like so:
Be aware that this will probably not look correct, unless the colour limits of your plot are set to the range [0.8, 12]. You can do this with:
Furthermore, a better way of adding the units ‘mm’ to your colourbar would be as follows: