Gnuplot 在数据上结合acspline和Filled曲线

Gnuplot 在数据上结合acspline和Filled曲线,gnuplot,bezier,curve,spline,smoothing,Gnuplot,Bezier,Curve,Spline,Smoothing,我知道如何使用filledcurve和使用1:2:3填充第2列和第3列描述的曲线之间的区域 我还知道如何使用ACSpline对单个曲线进行平滑,其中使用1:2:(0.1)(其中0.1是每个点的平滑权重) 但我无法将两者结合起来,即填充两条平滑曲线之间的区域。我尝试的所有变体都会给我错误消息,如数据文件选项中重复或矛盾的参数 这就是我所尝试的: plot 'datafile' using 1:2:3:(0.1):(0.1) smooth acs with lines plot 'datafile'

我知道如何使用
filledcurve
使用1:2:3
填充第2列和第3列描述的曲线之间的区域

我还知道如何使用ACSpline对单个曲线进行平滑,其中
使用1:2:(0.1)
(其中
0.1
是每个点的平滑权重)

但我无法将两者结合起来,即填充两条平滑曲线之间的区域。我尝试的所有变体都会给我错误消息,如数据文件选项中重复或矛盾的参数

这就是我所尝试的:

plot 'datafile' using 1:2:3:(0.1):(0.1) smooth acs with lines
plot 'datafile' using 1:2:(0.1):3:(0.1) smooth acs with lines

这种组合可能吗?语法如何呢?

我想你不能将
平滑acspline
与填充曲线相结合,但我也不知道为什么这不可能。
好的,作为一种解决方法,首先将
平滑acspline
曲线绘制到数据表中,然后使用填充曲线绘制

代码:

### filled acspline curve
reset session

$Data <<EOD
1 2
2 4
3 3
4 1
EOD

# plot your acspline data into a table
set table $ACSpline
    plot $Data u 1:2 smooth acspline
unset table

set style fill transparent solid 0.1 

plot $Data u 1:2 w lp pt 7 lc rgb "black" ti "Original data", \
     $Data u 1:2 smooth acspline lw 2 lc rgb "red" ti "acspline", \
     $ACSpline u 1:2 w filledcurves x1 lc rgb "red" ti "acspline filled"
### end of code
### filled curve between two acsplines
reset session

$Data <<EOD
1 2 4
2 4 1
3 3 0
4 1 3
EOD

# plot your acspline data into tables
set table $ACSpline1
    plot $Data u 1:2:(1) smooth acspline
unset table
set table $ACSpline2
    plot $Data u 1:3:(1) smooth acspline
unset table
set print $BetweenSplines
    do for [i=1:|$ACSpline1|] {
        print sprintf("%s %s %s",word($ACSpline1[i],1),word($ACSpline1[i],2),word($ACSpline2[i],2))
    }
set print

set style fill transparent solid 0.5 

plot $Data u 1:2 w lp pt 7 lc rgb "black" ti "Original data col 2", \
     $Data u 1:3 w lp pt 7 lc rgb "blue" ti "Original data col 3", \
     $ACSpline1 u 1:2 w l lw 2 lc rgb "red" ti "acspline col 2", \
     $ACSpline2 u 1:2 w l lw 2 lc rgb "green" ti "acspline col 3", \
     $BetweenSplines u 1:2:3 w filledcurves lc rgb "yellow" ti "acspline filled"
### end of code
结果:

### filled acspline curve
reset session

$Data <<EOD
1 2
2 4
3 3
4 1
EOD

# plot your acspline data into a table
set table $ACSpline
    plot $Data u 1:2 smooth acspline
unset table

set style fill transparent solid 0.1 

plot $Data u 1:2 w lp pt 7 lc rgb "black" ti "Original data", \
     $Data u 1:2 smooth acspline lw 2 lc rgb "red" ti "acspline", \
     $ACSpline u 1:2 w filledcurves x1 lc rgb "red" ti "acspline filled"
### end of code
### filled curve between two acsplines
reset session

$Data <<EOD
1 2 4
2 4 1
3 3 0
4 1 3
EOD

# plot your acspline data into tables
set table $ACSpline1
    plot $Data u 1:2:(1) smooth acspline
unset table
set table $ACSpline2
    plot $Data u 1:3:(1) smooth acspline
unset table
set print $BetweenSplines
    do for [i=1:|$ACSpline1|] {
        print sprintf("%s %s %s",word($ACSpline1[i],1),word($ACSpline1[i],2),word($ACSpline2[i],2))
    }
set print

set style fill transparent solid 0.5 

plot $Data u 1:2 w lp pt 7 lc rgb "black" ti "Original data col 2", \
     $Data u 1:3 w lp pt 7 lc rgb "blue" ti "Original data col 3", \
     $ACSpline1 u 1:2 w l lw 2 lc rgb "red" ti "acspline col 2", \
     $ACSpline2 u 1:2 w l lw 2 lc rgb "green" ti "acspline col 3", \
     $BetweenSplines u 1:2:3 w filledcurves lc rgb "yellow" ti "acspline filled"
### end of code

确实很有趣(我不知道这个表格功能)。但是…我如何用它来填充两条曲线之间的区域?你只填充一条曲线和一个轴之间的区域。对不起,我读得不够仔细。您希望它在两条ACS样条曲线之间填充。嗯,不知何故,您需要将平滑的数据放入一个数据块的两列中。我相信有办法。我需要考虑一下。这个解决方案有点粗糙,但很有效!(我更喜欢使用易于理解的可维护代码。)特别是,因为我的X坐标是特定格式的日期时间,所以我需要确保打印时间的格式与解析时间的格式相同,并且生成表(数据块)会在日期时间周围加上双引号(!)打印时会再次将其删除。但在弄明白所有这些之后,它成功了!非常感谢:-)很高兴听到这个消息,最后它不知怎么对你有用。日期时间是我到现在为止还没有的信息。gnuplot人(在Linux上)倾向于使用外部工具来(重新)排列或处理数据,但只要你能用gnuplot做到这一点,我更喜欢只使用平台独立的gnuplot解决方案。是的。datetime的内容应该更加透明。谁会想到我使用的是日期时间还是简单的数字会有不同呢?;-)