我有一个生成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
示例图片:
该脚本仅对负数集生成所需的图。如果我取消订单,我会得到蓝色的订单。
以下是示例数据: data_sample 仅供参考-这些数组很大
答案 0 :(得分:1)
正如@ user8153所指出的,我也看不出为什么使用splot
的原因。
正如@Christoph指出的那样,不知道数据的外观是很难的,
例如,$3
和$4
列中有什么?
顺便说一句,使用绘图命令...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
您将获得以下信息: