{"id":234,"date":"2004-09-22T13:55:52","date_gmt":"2004-09-22T18:55:52","guid":{"rendered":"https:\/\/blogs.mathworks.com\/pick\/?p=234"},"modified":"2016-05-10T09:00:42","modified_gmt":"2016-05-10T13:00:42","slug":"colorbars-for-filled-contours","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/pick\/2004\/09\/22\/colorbars-for-filled-contours\/","title":{"rendered":"Colorbars for filled contours"},"content":{"rendered":"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 <a title=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/loadFile.do?objectId=1135&amp;objectType=file (link no longer works)\"> COLORBARF <\/a> creates a colorbar that displays only the colors contained in the filled contour plot.\r\n\r\nThe figures below show the difference between COLORBAR and COLORBARF:\r\n\r\n&nbsp;\r\n\r\nOne tiny caution if you are using MATLAB 7 (R14). To ensure compatibility with COLORBARF, use the new 'v6' flag when calling CONTOURF, e.g.\r\n\r\n[cout,H]=contourf('v6',peaks);\r\ncolorbarf(cout,H)\r\n\r\nOne 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?","protected":false},"excerpt":{"rendered":"<p>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,... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/pick\/2004\/09\/22\/colorbars-for-filled-contours\/\">read more >><\/a><\/p>","protected":false},"author":33,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/234"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/users\/33"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/comments?post=234"}],"version-history":[{"count":1,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/234\/revisions"}],"predecessor-version":[{"id":6978,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/234\/revisions\/6978"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/media?parent=234"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/categories?post=234"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/tags?post=234"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}