Use of discrete colors in contourf and pcolor with colorbar

Version 1.1.0.0 (2.81 KB) by Makarand
To set specific colors to the filled contours and pcolor plots and then to set the correct colorbar.
1.3K Downloads
Updated 18 Oct 2010

View License

There are three three files
Recolor_pcolor.m , Recolor_contourf.m and colorbar_levels.m
The Recolor_pcolor/Recolor_contourf functions re-assign the specific colors to specific levels. The required colormap must be assigned to the pcolor/contourf plots before calling this function. The number of colors in the colormap must be one plus the length of levels.
While making the contourf plot make it on [min(data) Levels] levels. In addition to that keep max(Levels) <max(data)
After plotting pcolor set the caxis on bounds [min(data) max(Levels)]
All comments are welcome.
Thanks
Mak

Cite As

Makarand (2024). Use of discrete colors in contourf and pcolor with colorbar (https://www.mathworks.com/matlabcentral/fileexchange/28073-use-of-discrete-colors-in-contourf-and-pcolor-with-colorbar), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2008a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Colormaps in Help Center and MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.1.0.0

made little flexible two of the programs

1.0.0.0