File Exchange Pick of the Week

Our best user submissions

Colorbars for filled contours

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. [cout,H]=contourf('v6',peaks); colorbarf(cout,H) 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?
  • print


To leave a comment, please click here to sign in to your MathWorks Account or create a new one.