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

标签 colors gnuplot palette color-palette

一些与 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/

相关文章:

c++ - 使用 C++ 和 opencv 在图像中进行色彩平衡

colors - 如何确保用户自定义颜色的评论仍然可读?

c++ - Qt设置QLineEdit的背景颜色

gnuplot,绘制一段时间内个别事件的图表

command-line - 如何将命令行参数传递给 gnuplot?

flutter - Flutter-尝试从AssetImage加载时发生超时

PHP GD 调色板颜色

android - 如何将颜色保存到sqlite数据库

colors - Dribble 的颜色搜索是如何工作的?

python - gnuplot重绘: "Scan size of matrix is zero"