You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

基于直方图优化距离可视化的色彩渐变方案技术问询

色相光谱可视化距离的色彩映射优化问题

我认为这更偏向数学问题。我有一个基于色相光谱可视化距离并在地图上绘制的程序,问题在于距离值分布不均,导致仅能看到光谱中的少数颜色,效果十分单调。

附上可视化结果和直方图,可见大部分数据点集中在20-40%区间:
可视化结果
数据分布直方图

我的色彩映射函数代码如下:

def colour_gradient_from_distance(distance_array):
    spectre_size = 1    # number of iterations around rainbow, preferably < 1.0

    max_dist = numpy.amax(distance_array)
    min_dist = numpy.amin(distance_array)
    rangemm = max_dist - min_dist
    length = len(distance_array)
    colours = [None] * length

    for i in range(length):
        start = 0 # anything between 0 and 360
        hue = ((distance_array[i] - min_dist) / rangemm + (start / 360)) % 1 * spectre_size

        colours[i] = hue # only hue is changed, the other two are 1.0
    return colours

这是一个较为基础的函数,我已尝试过对数、指数、线性函数等20余种方案,但均未解决问题。目前我正针对当前的数据分布进行调整,但理想状态下希望方案能适配所有分布情况。请问是否有可行的优化思路?


内容的提问来源于stack exchange,提问作者user6346482

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.13 10:52:37