Gnuplot:如何设置颜色框中特定颜色的范围

时间:2014-06-04 20:02:48

标签: gnuplot colorbox legend

我想在调色板中定义特定颜色的范围:

例如:

set pm3d;
set pm3d map;
splot x*y;

给出:

enter image description here

我希望红色从-50到50开始。我该怎么做?

1 个答案:

答案 0 :(得分:1)

对于标准gnuplot调色板的情况,您可以按如下方式实现:

定义gnuplot标准调色板的红色,绿色和蓝色值的函数是

red(x) = sqrt(x)
green(x) = x**3
blue(x) = sin(2*pi*x)

请参阅show palette以了解使用了哪些功能(rgb color mapping by rgbformulae are 7,5,15)。使用show palette rgbformulae,您可以找到与此数字相关联的函数。

所以你的例子相当于

red(x) = sqrt(x)
green(x) = x**3
blue(x) = sin(2*pi*x)

set palette functions red(gray), green(gray), blue(gray)
set pm3d map
splot x*y

现在,您可以将映射函数应用于gray值。此功能必须将原始灰度范围[0:1]映射到范围[0:1]范围内的新灰度范围,例如map(x) = (x < 0.25 ? 2*x : (x > 0.75 ? 2*x - 1 : 0.5)) red(x) = sqrt(x) green(x) = x**3 blue(x) = sin(2*pi*x) set palette functions red(map(gray)), green(map(gray)), blue(map(gray)) set pm3d map splot x*y 。与

test palette

测试调色板定义的一种好方法是使用map(x) = (x < 0.25 ? 2*x : (x > 0.75 ? 2*x - 1 : 0.5)) red(x) = sqrt(x) green(x) = x**3 blue(x) = sin(2*pi*x) set palette functions red(map(gray)), green(map(gray)), blue(map(gray)) test palette

{{1}}

enter image description here