gpt4 book ai didi

colors - gnuplot 调色板,默认和定义

转载 作者:行者123 更新时间:2023-12-02 09:41:39 29 4
gpt4 key购买 nike

一些与 previous question 相关的内容

我想采用 gnuplot 的默认(pm3d 默认)调色板,并在 X 处放置一个白色值,并将任何 >=X 的内容设置为白色,但其余部分(

例如,我的值在 0 到 100 之间。我只对 0 到 30 的值感兴趣,所以我执行以下操作:

set cbrange [0:30]

现在,使用默认调色板,值在 0 到 30 之间均匀分布,但值 30.001 到 100 都是黄色。我想在调色板的顶部放置一个白色 block ,在颜色栏上说这样的话

0:30 使用默认调色板均匀分布30:31 白

在实际图中,值 >=30 为白色。

我知道我可以设置定义的值,但我似乎无法将默认的 rgbformula 7,5,15 和定义的点 30=white 结合起来。

有什么想法吗?

最佳答案

您可以使用设置调色板函数来定义自己的基于函数的调色板。输入 show Palette rgbformulae 显示用于默认调色板 (7,5,15) 的函数的定义:

gnuplot> show palette rgbformulae
* there are 37 available rgb color mapping formulae:
0: 0 1: 0.5 2: 1
3: x 4: x^2 5: x^3
6: x^4 7: sqrt(x) 8: sqrt(sqrt(x))
9: sin(90x) 10: cos(90x) 11: |x-0.5|
12: (2x-1)^2 13: sin(180x) 14: |cos(180x)|
15: sin(360x) 16: cos(360x) 17: |sin(360x)|
...

因此,您可以为红色、绿色和蓝色定义自己的函数,从而在调色板的一端提供白色:

r(x) = sqrt(x)
g(x) = x**3
b(x) = (x == 1 ? 1 : sin(2*pi*x))
set palette functions r(gray),g(gray),b(gray)

为了演示,这里是一个完整的示例脚本,其中所有高于 -10 的值都是白色:

r(x) = sqrt(x)
g(x) = x**3
b(x) = (x == 1 ? 1 : sin(2*pi*x))
set palette functions r(gray),g(gray),b(gray)
set isosamples 100
set pm3d map
set cbrange [-200:-10]
set cbtics -200,40
set cbtics add ('> -10' -10)
splot -x**2 - y**2 notitle

4.6.5 的输出是:

enter image description here

关于colors - gnuplot 调色板,默认和定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25966773/

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