I'll start a new anwer using a different approach. This time we'll manually define everything - no shortcuts. That should allow you more control over what is going on, making it easier for you to adapt.
Going back to your original question:
- 0-10 = red, tick at 5
- 11-20 = blue, tick at 15
- etc.
First, create a custom colormap, manually specifying the colors and the range they apply to. Note that the ranges aren't equal (one has 5 in it). Not sure why 0-10 is 10 and not 11, but hey, it's working.
cmap = [repmat([1 0 0],10,1)
repmat([0 0 1],10,1)
repmat([0 1 0],10,1)
repmat([1 1 0],5,1)];
If you want more colors, add them to cmap. Just adjust the pattern to match the ranges you specify.
With that defined, plot your data. Then set the colormap, caxis limits, and ticks as follows:
colormap(cmap)
h=colorbar;
caxis([0 35])
set(h,'Ticks',[5 15 25 32.5])
Set the ticks to whatever you want to use. It will by default use its value as the label.
If you want the tick label to be different from the tick value, set the tick label property as well. For example, if I wanted the label to display in the middle of the range but show the max value of the range, I'd do this instead:
set(h,'Ticks',[5 15 25 32.5],'TickLabels',num2str([10; 20; 30; 35]))