gpt4 book ai didi

.net - 为 DataGridView 着色以直观地查看单元格值的整个分布的算法

转载 作者:塔克拉玛干 更新时间:2023-11-03 03:08:16 26 4
gpt4 key购买 nike

我有一个数字矩阵。 DataGridView 用于显示它。我需要一种算法,根据单元格的值为每个单元格计算其背景色。因此,在查看 DataGridView 时,我将能够直观地看到值的整个分布。因此,具有接近值的单元格将具有相似的颜色。

最佳答案

求出矩阵的最大值和最小值,设置背景的色调为

Hue(a(i,j)) = (a(i,j) - min)/(max - min))

你可能会得到例如(Mathematica中的代码,不要介意,只是作为一个例子):

a = Table[x + Sin[3 x + y^2], {x, -3, 3, 0.1}, {y, -3, 3, 0.1}];
ArrayPlot[a, ColorFunction -> (Hue[(# - min)/(max - min), 1, 1] &)],
ColorFunctionScaling->False ]

enter image description here

编辑

作为引用,这个函数的3D图是

enter image description here

关于.net - 为 DataGridView 着色以直观地查看单元格值的整个分布的算法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6749405/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com