Custom colormap

版本 1.0.0.0 (2.8 KB) 作者: Erik Kvaleberg
Create custom colormaps from single or multiple RGB values.
2.8K 次下载
更新时间 2013/7/1

查看许可证

CMAP creates a custom colormap based on RGB values in the MATLAB format(values between 0-1). By specifying a base color, for example green: [0 1 0], CMAP creates a colormap with a specified number of colors around this value, and omits the darkest/lightest colors based on user input. Combine several CMAP calls to create multi-color maps as the example image shows.

Inputs:
- Base color
- Number of colors in the colormap (optional)
- Percentage cut of darkest colors (optional)
- Percentage cut of lightest colors (optional)

By downloading RGB triple of color name, version 2 (File ID: #24497), by Kristjan Jonasson, CMAP input may be specified as color names ('seagreen', 'darkred', etc.)

Example:
figure; pcolor([0:20;0:20]); cmap([0 1 0],10,20,5); colorbar
This gives a colormap in green tones, with 10 colors. 20% of the darkest colors and 5% of the lightest colors have been cut.

The attached sample figure (global mean sea surface temperature in July) was plotted using:
colormap([cmap('steelblue',50,10,0);flipud(cmap('orangered',50,10,0))]);

引用格式

Erik Kvaleberg (2024). Custom colormap (https://www.mathworks.com/matlabcentral/fileexchange/42450-custom-colormap), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2012a
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Colormaps 的更多信息

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.0.0.0