2017-05-14 65 views
1

我有数据(如一系列(x,y,z)点),我需要使用实际光谱颜色(从(红外)红色到(超)根据z,紫色包括绿色)。所以我需要热图像
enter image description heregnuplot:热图如3d表面的可见光谱

那么,我该如何做到这一点?

除了着色之外,一切都很好。

如果有必要,有我的gnuplot脚本:

set hidden3d 
set dgrid3d 47*4,205*1 gauss 2 
set pm3d 
set cbrange[1.007694:1.210099] 
set xrange [] reverse 
unset ztics 
unset key 
set view 10,70 
set xlabel "x" 
set ylabel "y" 
set ticslevel 0 

set term postscript eps enhanced monochrome 
set output "plot-m.eps" 
splot 'plot.d' with lines 

set term postscript eps enhanced color 
set output "plot-c.eps" 
replot 

set terminal png size 1024,768 enhanced font "DejaVu Serif,20" 
set output "plot-c.png" 
replot 

而且我样品图片:enter image description here

回答

1

我产生了兴趣,你的问题,所以我发现this,并提出了gnuplot的脚本。这里调色板设置为“功能”,即R,G和B在[0:1]的范围内计算。您可以将绘图范围映射到范围[400:700]以获得您的绘图的全部光谱。范围是400到700纳米。

reset 
set term pngcairo size 1200,800 
set output 'colormap2.png' 

R(k)=(\ 
l=k*300+400, \ 
(l>=400.0 && l<410.0)? (t=(l-400.0)/(410.0-400.0), (0.33*t)-(0.20*t*t)) : \ 
(l>=410.0 && l<475.0)? (t=(l-410.0)/(475.0-410.0), 0.14-(0.13*t*t)) : \ 
(l>=545.0 && l<595.0)? (t=(l-545.0)/(595.0-545.0), (1.98*t)-(t*t)) : \ 
(l>=595.0 && l<650.0)? (t=(l-595.0)/(650.0-595.0), 0.98+(0.06*t)-(0.40*t*t)) : \ 
(l>=650.0 && l<700.0)? (t=(l-650.0)/(700.0-650.0), 0.65-(0.84*t)+(0.20*t*t)) : \ 
0.0) 


G(k)=(\ 
l=k*300+400, \ 
(l>=415.0 && l<475.0)? (t=(l-415.0)/(475.0-415.0), (0.80*t*t)) : \ 
(l>=475.0 && l<590.0)? (t=(l-475.0)/(590.0-475.0), 0.8+(0.76*t)-(0.80*t*t)) : \ 
(l>=585.0 && l<639.0)? (t=(l-585.0)/(639.0-585.0), 0.84-(0.84*t)) : \ 
0.0) 

B(k)=(\ 
l=k*300+400, \ 
(l>=400.0 && l<475.0)? (t=(l-400.0)/(475.0-400.0), (2.20*t)-(1.50*t*t)) : \ 
(l>=475.0 && l<560.0)? (t=(l-475.0)/(560.0-475.0), 0.7-t+(0.30*t*t)) : \ 
0.0) 

set palette model RGB functions R(gray),G(gray),B(gray) 
set pm3d map 
set samples 2000 
set xrange [400:700] 
set cbrange [400:700] 
splot x 

enter image description here

+0

谢谢您的回答,结果正是我想要的。但似乎我发现[更简单的事情](https://yassernour.wordpress.com/2009/08/08/creating-high-quality-plots-using-gnuplot/):'set palette rgbformulae 22,13, -31'但它不完全相同。将会发现它是如何工作的以及如何调整它... – Abelisto

+0

你可以将你的示例调色板图像加载到一些能够进行图像处理(matlab/octave等)的软件中,并将颜色分解为R,G和B分量,然后这些组件的近似曲线以获得拟合函数,然后您可以应用我的方法。 –