您无需编写函数或数据文件。好吧,我正在努力限制填充曲线的范围。类似以下内容(我认为很简单)不起作用:(我仍然不完全理解为什么)。它给出的是消息,warning: Ignoring sample range in non-sampled data plot
而不是预期的结果(gnuplot 5.2.8)。
plot [1950:2020] $Data u 1:2 w filledcurves x1 lc "red", \
[1940:2100] '' u 1:2 w l lw 2 lc "black"
因此,我改为使用三元运算符来限制填充的xrange。
码:
### fill below a part of a curve
reset session
# create some test data
f(x) = 2.5e5*(x-1900)**2
set table $Data
plot sample [1940:2100:5] '+' u 1:(f($1)) w table
unset table
unset key
set grid xtics, ytics front
set xrange [1940:2100]
set style fill solid 0.3
LimitRange(x,x0,x1) = x0<=x && x<=x1 ? x : NaN
plot $Data u (LimitRange($1,1950,2020)):2 w filledcurves x1 lc "red", \
'' u 1:2 w l lw 2 lc "black"
### end of code
结果:
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句