Date 使用gnuplot中x轴上的日期绘制拟合线的范围
我试图为下面给出的数据集绘制拟合函数(第3列与第7列)Date 使用gnuplot中x轴上的日期绘制拟合线的范围,date,range,gnuplot,Date,Range,Gnuplot,我试图为下面给出的数据集绘制拟合函数(第3列与第7列) 28-08-1991 20-12-1992 24-04-1992 -263347200 -221875200 -242611200 0.060859 20-12-1992 02-09-1993 27-04-1993 -221875200 -199756800 -210816000 0.064681 10-09-1996 13-09-1997 13-03-1997 -104371200 -72576000
28-08-1991 20-12-1992 24-04-1992 -263347200 -221875200 -242611200 0.060859
20-12-1992 02-09-1993 27-04-1993 -221875200 -199756800 -210816000 0.064681
10-09-1996 13-09-1997 13-03-1997 -104371200 -72576000 -88473600 0.095728 ......
我希望我的脚本只在一定的日期范围内,比如1995年到2003年,绘制合适的曲线。我无法正确获取范围函数,因为gnuplot处理2000年之后的日期
请在下面找到我的代码
set xdata time
set timefmt "%d-%m-%Y"
set xrange ["01-01-1991":"01-01-2015"]
set yrange [0.0:0.4]
offset = 24*60*60
f(x) = 1.e-7*m*(x-offset)+c
fit f(x) "file" using 3:7 via m,c
set fit logfile 'file.log'
plot '(x < "24-02-1993" ) ? f(x) : 1/0' title "Best fit" with lines ls 5
设置扩展数据时间
设置时间“%d-%m-%Y”
设置X范围[“01-01-1991”:“01-01-2015”]
设置Y范围[0.0:0.4]
偏移量=24*60*60
f(x)=1.e-7*m*(x偏移量)+c
通过m,c使用3:7拟合f(x)“文件”
设置fit日志文件“file.log”
地块(x<“24-02-1993”)?f(x):1/0'标题“最佳匹配”,第5行
绘图中的变量x
将以秒的形式包含自1970年1月1日以来的时间。因此,为了将其与日期进行比较,您需要使用strtime
将该日期转换为相同的格式
如果您另外删除MWE中要绘图的函数周围的”
,则会得到:
plot (x<strptime("%d-%m-%Y","24-02-1993"))?f(x):1/0 title "Best fit" with lines ls 5
绘图(x