MATLAB: Colorbar for categorical data

categorical datacolorbarlegendpcolor

I have a spatial, categorical dataset that I have plotted up using pcolor. The dataset contains latitude, longitude and vegetation type data. Vegetation type is an arbitrary number between 1 and 19 that corresponds to a vegetation label.
I am looking for a way to create a colorbar "legend" for this data.
At the moment, when I use pcolor and add a colorbar, I get a bar that goes from 1 – 19 with all the different colours in between. This colorbar means nothing because the data are not ordinal.
I am hoping to find a way to make little boxes for each individual color, and put a label next to the box. Something like the maps of Australia seen on this site http://www.environment.gov.au/node/22149
Is there a way to code this in Matlab, given that I have 19 different vegetation types, and putting labels next to the colorbar would be too busy?
Thanks for your help.

Best Answer

Have you seen the demo for colorbar where they change the labels from numbers to some custom words? Try that:
surf(peaks(30))
colorbar('YTickLabel',...
{'Freezing','Cold','Cool','Neutral',...
'Warm','Hot','Burning','Nuclear'});