语法
- string colorRamp(gradient, value)
参数
- gradient - string{ "whiteToBlack" | "greenToRed" | "yellowToRed" | "redToBlue" | "orangeToBlue" | "brownToBlue" | "spectrum" } - 预设不同的色带。
- value - float (range[0,1])
返回
色带中符合给定 value 的十六进制颜色值(使用 gradient 进行选择)。 意味着 value 会映射到色带上并返回对应的颜色。
示例
黄色到红色色带
| ![]() |
注:
要可视化数据集,使用函数 " x_norm = 1 / (max - min) * (x - min) " 将值“归一化”为范围 [0-1]。
基于 GIS 数据集的色带示例图像
黄色到红色:

红色到蓝色:

绿色到红色:

白色到黑色:

橙色到蓝色:

棕色到蓝色:

光谱:
