Version (3.01 KB) by Jurgen
Set colormap entry for zero values to specified RGB color
Updated 24 Jan 2013

View License

The images are generated by the examples in the help section.

Updates current figure's colormap so that zeros get color CLR. CLR is a vector between 0-1, e.g. [.4 .2 .9] or a standard MATLAB color string.

cmap = zerocolor(H,CLR)
Returns the updated colormap cmap based on the figure with handle H.

See the function help for all the syntax options. Not hard to adjust the code for an arbitrary value other than zero.

feedback is welcome

Cite As

Jurgen (2024). Zerocolor (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2008a
Compatible with any release
Platform Compatibility
Windows macOS Linux
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