具有多个数据集的gnuplot splot

具有多个数据集的gnuplot splot,plot,gnuplot,surface,Plot,Gnuplot,Surface,我有一个生成gnuplot文件的脚本,我已经编辑过,所以在同一个绘图中有两组数据。一乘以-1可以改变颜色。但是,图中仅显示一组,即最后一组。脚本如下所示 set arrow from graph 0,first 0.61237, graph 0 to graph1,first0.61237,0 nohead front lt -1 set arrow from graph 0,first 1.67303, graph 0 to graph 1,first 1.67303,0 nohead f

我有一个生成gnuplot文件的脚本,我已经编辑过,所以在同一个绘图中有两组数据。一乘以-1可以改变颜色。但是,图中仅显示一组,即最后一组。脚本如下所示

set arrow from  graph 0,first 0.61237, graph 0 to graph1,first0.61237,0 nohead front lt -1
set arrow from  graph 0,first 1.67303, graph 0 to graph 1,first 1.67303,0 nohead front lt -1
set arrow from  graph 0,first 2.53906, graph 0 to graph 1,first 2.53906,0 nohead front lt -1
set arrow from  graph 0,first 3.24616, graph 0 to graph 1,first 3.24616,0 nohead front lt -1
set arrow from  graph 0,first 3.74616, graph 0 to graph 1,first 3.74616,0 nohead front lt -1
set arrow from  graph 0,first 4.74616, graph 0 to graph 1,first 4.74616,0 nohead front lt -1
set pm3d at b
unset surf
set view 180,90
set palette defined (-1 "red",0 "white", 1 "blue");
set grid xtics mxtics ytics
unset border
set xrange [-10:40]
set xtics -10,((40+10)/5),40
set mxtics 3
set yzeroax lt 2
set ytics ("L" 0.0,"K" 0.61237,"G" 1.67303,"L" 2.53906,"W" 3.24616,"X" 3.74616,"G" 4.74616)

set cbrange resto
set cbrange[-1:1]
set colorbox
set terminal png enhanced  nocrop  size 1920,1080
set out "SPF_NO_SO.png"
splot "specfun.pm3d" u ($1*13.60569806):2:(1*$4/476.70750366666666666666),\
      "specfun.pm3d" u ($1*13.60569806):2:(1*$3/573.04673900000000000000)
unset out
示例图像:

脚本仅为负数集生成所需的绘图。如果我改变顺序,我会得到蓝色的

以下是一个示例数据:
仅供参考,正如@user8153所指出的,这些数组相当大,我也看不出为什么要使用
splot
。 正如@Christoph所指出的,如果不知道数据是什么样子,这是很困难的, 例如,
$3
$4
列中有什么? 顺便说一下,使用plot命令
…u($1*13.60569806):2
您不是将同一个函数在彼此的顶部绘制两次吗,也就是说,这就是为什么您会看到红色或蓝色? 尽管如此,我还是试着预测你可能想做什么。我缩放了第二个函数,并假设列
$3
$4
是线性的。请澄清

使用代码:

### start code
reset session

# generate some dummy data
undefine $Data
set print $Data append
do for [n=1:5] {
    a = rand(0)*10
    b = rand(0)*0.1+0.1
    c = rand(0)*20
    do for [i=1:100] {
        print sprintf("%g\t%g\t%g\t%g",i,(a*sin(b*i-c)),cos(b*i),cos(b*3*i))
    }
    print "" # insert empty line for data curve separation
}
set print
# print $Data   
# end generating dummy data

set palette defined (-1 "red",0 "white", 1 "blue")
set cbrange [-1:1]
plot $Data u 1:2:($3-$4) w l lc palette z
### end of code
您将获得以下信息:


从图像上看有点困难,但你不是在二维图形上画了很多线吗?如果是这样的话,最好使用
plot
而不是
splot
…每个点都有一个权重,即最后一个坐标。如果手头没有任何测试数据,很难提供帮助。列$3和$4是颜色的权重。我没有写这个脚本,我试着编辑它,尽我所能理解它,然后在mathematica做我想做的事情。这是我自己的教诲。基本上,我们让它们共享相同的2x2XY网格,然后根据重量,给定的点应该是红色或蓝色。好的,这是一个大文件。第3列和第4列的范围都在大约0到1900之间,但形状不同。您正在用不同的颜色绘制同一条曲线
u($1*13.605):2
两次,当然,您只能看到一条或另一条曲线。基本上,您有一条曲线
u1:2
,您需要一列
3
4
或它们的组合值来告诉gnuplot在哪里以及如何给这条曲线上色。我仍然不清楚曲线应该是红色,应该是蓝色。我明白你现在说的,我想最好的方法是把第3列的平均值和第4列的负值取出来。那可能行。我调整了示例代码,并在
$3
$4
中假设了一些
cos(x)
函数。