climbnd

Adjusts clim values so that bounding colors correspond to out-of-range values
3 Downloads
Updated 4 Mar 2023

View License

CLIMBND Adjusts clim values so that bounding colors are restricted to those values that lie outside of the cmin and cmax limits.
Usage:
climbnd([cmin, cmax])
climbnd(hA, [cmin, cmax])
hA: axis handle
cmin, cmax: minimum and maximum limits for color plot
Background:
climbnd provides a way account for values that lie out of the climit range. The Matlab documentation for the clim function states:
"All values in the colormap indexing array that are less than or equal to cmin map to the first row in the colormap. All values that are greater than or equal to cmax map to the last row in the colormap.
All values between cmin and cmax map linearly to the intermediate rows of the colormap."
This definition means that that the first and last colors are used for values outside the climit range and also as part of the color ramp for values that lie inside the climit range.
As a result, the bounding colors do not align correctly with the cmin and cmax limits. The climbnd function allows for the first and last colors in the color map to represent values that are outside the climit range.
Motivation:
I came across this problem when trying to create a pcolor plot of cloud water in a cross section of the atmosphere. I wanted regions with negative values of cloud water density to plot with a blue color (cmin = 0), and the positive values to plot with a color ramp going from light to dark gray for the range cmin to cmax. The Matlab clim function allowed the bounding blue color to extend into the positive range for the cloud water density.
Mark Brandon, Yale University, 2020-2022

Cite As

Mark Brandon (2024). climbnd (https://www.mathworks.com/matlabcentral/fileexchange/117255-climbnd), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2022a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes
1.0.1

Fixed some typos in the description

1.0.0