This weeks pick adds very useful functionality for anybody who works with filled contour plots (as created by contourf). MATLAB's standard colorbar isn't particularly well suited to filled contours, since it displays ever color in the colormap while the filled contour plot uses a smaller subset of colors. Blair Greenan's COLORBARF
creates a colorbar that displays only the colors contained in the filled contour plot.
The figures below show the difference between COLORBAR and COLORBARF:
One tiny caution if you are using MATLAB 7 (R14). To ensure compatibility with COLORBARF, use the new 'v6' flag when calling CONTOURF, e.g.
One more thing - are you impressed that I made it through this entire posting without making a snide comment about the name Blair chose for this function?