gnuplot调色板,默认和已定义 [英] gnuplot palette, default and defined
问题描述
一些与>上一个问题
我想使用gnuplot的默认调色板(默认为pm3d),并在X处放置一个白色值,并将> = X的任何东西都设置为白色,但其余(< X)仍将最终使用默认值进行分配.
I would like to take the default (pm3d default) colour palette of gnuplot and place a white value at X and have anything >=X as white but the rest(<X) still evently distributed with the default value.
例如,我的值在0到100之间.我只对0到30的值感兴趣,所以我执行以下操作:
Say for example I have values between 0 and 100. I am only interested in values 0 to 30 so I do the following:
set cbrange [0:30]
现在,默认调色板将值平均分配在0到30之间,但是30.001到100的值都是黄色.我想在调色板的顶部放置一个白色的方块,在颜色栏上说这样的话
Now values are evenly distributed between 0 and 30 with the default colour palette, however values 30.001 to 100 are all yellow. I would like to place a white block at the top of my colour palette, say something like this on the colour bar
0:30使用默认调色板均匀分布 30:31白色
0:30 evenly distribute with default palette 30:31 white
在实际图中,白色的值> = 30.
and in the actual plot, have values >=30 as white.
我知道我可以设置定义的值,但是我似乎无法结合默认的rgbformula 7,5,15和定义的点30 = white.
I know I can set defined values, but I can't seem to combine the default rgbformula 7,5,15 and a defined point of 30=white.
有什么想法吗?
推荐答案
您可以使用set palette functions
定义自己的基于函数的调色板.键入show palette rgbformulae
会显示用于默认调色板(7,5,15
)的功能的定义:
You can define your own, function-based palette with set palette functions
. Typing show palette rgbformulae
shows you the definitions of the functions used for the default palette (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)|
...
因此,您可以定义自己的红色,绿色和蓝色功能,从而在调色板的一端显示白色:
So you can define your own functions for red, green and blue which give white at one end of the palette:
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的值均为白色:
For demonstration, here is a full example script, where all values above -10 are white:
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的输出是:
Output with 4.6.5 is:
这篇关于gnuplot调色板,默认和已定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!