本文主要是介绍【源码】红蓝颜色映射生成器,零为白色或黑色,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
生成一个红-蓝颜色映射,0为白色或黑色。
Generates a RED-BLUE colormap with zero as white or black.
正值显示为蓝色强度,负值显示为红色强度。
Positive values are displayed as blue intensities and negative values are displayed as red intensities.
零可以选择为白色或黑色。
Zero can be selected to be either white or black.
图像中的或可以输入的clim值用于自定义颜色映射。
The clim values, from the image or can be entered, are used to customize the colormap.
语法:
Syntax: y = redblue(n,clim,‘black’)
Typical usage: colormap(redblue(64))
所有参数都是可选的,可以按任何顺序排列。
n——颜色级别数(默认为当前颜色映射的颜色数)
clim——指定颜色限制的双元素向量(默认值:当前轴颜色限制)
black——string(‘k’或’black’)指定零为黑色(默认零为白色)
Arguments:
All arguments are optional and can be in any order.
n - number of color levels (default is # of colors of current colormap)
clim - two element vector specifying the color limits (default: current axis color limits)
black - string (‘k’ or ‘black’) specifying zero as black (default is zero as white)
该代码将为任何图像创建自定义颜色映射。
This creates a custom colormap for any image.
根据图像的caxis值,色条刻度将偏向红色或蓝色。
The colorbar scale will be skewed toward red or blue depending on the caxis values of the image.
两个版本:
redblue.m——这个版本会压平彩色地图的边缘,以改善梯度的可视化。对于较大的n值,效果更好。
redblueu.m——这个版本对红色和蓝色使用统一的比例。白色和黑色会出现在更大的部分。
Two versions:
redblue.m - This version flattens the edges of the colormap to improve the visualization of the gradient. The effect works better for larger values of n.
redblueu.m - This version uses a uniform scaling for red and blue. The white and black will appear to be a larger section.
请记住,如果比例非常倾斜,就不会有太多的颜色渐变。使用自己的clim值可以增加渐变。
Keep in mind that if the scale is very skewed, there will not be much of a color gradient. The gradient can always be increased by using your own clim values.
示例
% Example:
% y = caxis; % e.g. y = [-11,-5]
% colormap(redblue(64) % and not much gradient
% colormap(redblue(64,[-11,0])) % white is at -5 with a larger gradient
更多精彩文章请关注公众号:
这篇关于【源码】红蓝颜色映射生成器,零为白色或黑色的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!