2017-05-18 25 views
3

我想要绘制两个2D标量,一个为热图和一个为叠加轮廓,使用下面的代码:产生gnuplot的:轮廓和热图来自同一splot两个不同的文件

set contour base 
set cntrparam levels incremental 0,0.25,1.25 
unset surface 
set table cont2.dat 
splot 'vr245.gnu' 
unset table 
reset 
set xrange [1:215] 
set yrange [0:3.1415925025940E+00] 
set cbrange [7:17] 
unset key 
set view map 
set palette rgbformulae 33,13,10 
splot 'f_aveFe_245.gnu' u 1:2:3 with pm3d, "cont2.dat" u 1:2:3 w l 

结果由gnuplot Result produced by gnuplot

正如你所看到的轮廓在左边有文物。我该如何解决这个问题?谢谢!

Input files are here.

回答

1

这其实挺有意思的。这个问题似乎出现在对应于1.25的水平的特定轮廓上。我想我把这个问题分离出来了。

让我们假设我们有一个简单的数据文件作为

215 2.55865 1.25 
212.185 2.56004 1.25 
215 2.87839 1.25 

215 0.2632 1.25 
212.185 0.252052 1.25 
215 0.582938 1.25 

目前,gnuplot的命令(S)

unset key 
set view map 

set xr [212:215.5] 
set yr [0:3] 

set xtics nomirror 
set ytics nomirror 

splot \ 
    'file.dat' w lp, \ 
    '' u 1:2:3:(sprintf("%d", $0)) w labels offset char 0, char -0.5 

产生 enter image description here

有趣的是,还分1和4加入。如果数据文件被修改为

215 2.55865 1.25 
212.185 2.56004 1.25 
215 2.87839 1.25 
# 
215 0.2632 1.25 
212.185 0.252052 1.25 
215 0.582938 1.25 

gnuplot的预期仅连接点2和3: enter image description here

什么似乎帮助这里是复制的空行,也就是说,这个文件

215 2.55865 1.25 
212.185 2.56004 1.25 
215 2.87839 1.25 


215 0.2632 1.25 
212.185 0.252052 1.25 
215 0.582938 1.25 

给出确实断开组件: enter image description here

到App LY这在脚本中,人们可能会援引例如gawk和仅需要复制文件中的所有空行与计算出的轮廓:通过使用plot

set terminal pngcairo 
set output 'fig.png' 

set contour base 
set cntrparam levels incremental 0,0.25,1.25 
unset surface 
set table 'cont2.dat' 
splot 'vr245.gnu' 
unset table 
reset 

set xrange [1:215] 
set yrange [0:pi] 
set cbrange [7:17] 
unset key 
set view map 
set palette rgbformulae 33,13,10 
splot \ 
    'f_aveFe_245.gnu' u 1:2:3 with pm3d, \ 
    '<gawk "NF==0{print;} {print;}" cont2.dat' u 1:2:3 w l 

这给 enter image description here

或者,你可能会解决这个问题绘制的轮廓,而不是splot

set terminal pngcairo 
set output 'fig.png' 

set contour base 
set cntrparam levels incremental 0,0.25,1.25 
unset surface 
set table 'cont2.dat' 
splot 'vr245.gnu' 
unset table 
reset 

set xrange [1:215] 
set yrange [0:pi] 
set cbrange [7:17] 
unset key 
set view map 
set palette rgbformulae 33,13,10 

set multiplot 

set tmargin at screen 0.9 
set lmargin at screen 0.1 
set rmargin at screen 0.8 
set bmargin at screen 0.1 

splot \ 
    'f_aveFe_245.gnu' u 1:2:3 with pm3d 

unset xtics 
unset ytics 
unset border 
unset key 
plot \ 
    'cont2.dat' w l 
1

可以有选择地接通或断开所述表面的轮廓和绘图为个人情节在一个单一的污点。定义脚本都pm3dcontours,停用第一和表面轮廓的

reset 
set contour base 
set cntrparam levels incremental 0,0.25,1.25 
set cntrlabel onecolor 
set autoscale xfix 
set autoscale yfix 
set cbrange [7:17] 
unset key 
set view map 
set palette rgbformulae 33,13,10 
splot 'f_aveFe_245.gnu' u 1:2:3 with pm3d nocontour, \ 
    'vr245.gnu' u 1:2:3 w l lc rgb "black" nosurface 

enter image description here

相关问题