【源码】红蓝颜色映射生成器,零为白色或黑色

在这里插入图片描述
生成一个红-蓝颜色映射,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

更多精彩文章请关注公众号:在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值