Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/csharp-4.0/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
gnuplot:events的柱状图:timecolumn()的问题_Gnuplot - Fatal编程技术网

gnuplot:events的柱状图:timecolumn()的问题

gnuplot:events的柱状图:timecolumn()的问题,gnuplot,Gnuplot,我想看看每个时间段的事件数 我的排像这样 "2020-11-11 09:15:50",field2,field3 这就是我尝试过的 binwidth = 3600 # 1h in seconds bin(t) = (t - (int(t) % binwidth) + binwidth/2) set datafile separator "," #set xdata time set timefmt '"%Y-%m-%d %H:%M:%S&quo

我想看看每个时间段的事件数

我的排像这样

"2020-11-11 09:15:50",field2,field3
这就是我尝试过的

binwidth = 3600 # 1h in seconds
bin(t) = (t - (int(t) % binwidth) + binwidth/2)
set datafile separator ","
#set xdata time
set timefmt '"%Y-%m-%d %H:%M:%S"'
set boxwidth binwidth
plot 'Statistics.log' using (bin(timecolumn(1, '"%Y-%m-%d %H:%M:%S"'))):(1) smooth freq with boxes
我要走了

unknown type in magnitude()
我如何调试这些错误?(如何转储gnuplot为timecolumn()等“看到”的内容?)


(gnuplot 4.6)

首先,gnuplot 4.6中的
timecolumn()
是一个单参数函数,只允许列号的参数。因此,plot命令可以重写为

plot "test.dat" using (bin(timecolumn(1))):(1) smooth freq with boxes
其次,不要在TimeFinder格式中包含前导双引号和尾随双引号

set timefmt '%Y-%m-%d %H:%M:%S'

有关详细信息,请参阅“帮助数据”部分

但是,当出现以下情况时,将忽略一对双引号内的空白 计算列数,因此以下数据文件行有三列:

1.0“第二列”3.0

最后,您的代码可以修改如下(对于gnuplot4.6)


首先,gnuplot4.6中的
timecolumn()
是一个单参数函数,只允许列号的参数。因此,plot命令可以重写为

plot "test.dat" using (bin(timecolumn(1))):(1) smooth freq with boxes
其次,不要在TimeFinder格式中包含前导双引号和尾随双引号

set timefmt '%Y-%m-%d %H:%M:%S'

有关详细信息,请参阅“帮助数据”部分

但是,当出现以下情况时,将忽略一对双引号内的空白 计算列数,因此以下数据文件行有三列:

1.0“第二列”3.0

最后,您的代码可以修改如下(对于gnuplot4.6)


晚了几分钟。。。在测试时@宾佐基本上已经回答了

唯一的区别是:如果数据对日期使用双引号

"2020-11-11 09:15:50",field2,field3`
如果不想更改现有数据,则必须在
set timemt
中指定它。出于某种我现在无法解释的奇怪原因,如果您设置数据文件分隔符“,”它会弄乱图形,但如果没有它,它似乎可以工作

代码:(使用gnuplot 4.6.0测试)

结果:


晚了几分钟。。。在测试时@宾佐基本上已经回答了

唯一的区别是:如果数据对日期使用双引号

"2020-11-11 09:15:50",field2,field3`
如果不想更改现有数据,则必须在
set timemt
中指定它。出于某种我现在无法解释的奇怪原因,如果您设置数据文件分隔符“,”它会弄乱图形,但如果没有它,它似乎可以工作

代码:(使用gnuplot 4.6.0测试)

结果:


似乎就是这样,谢谢。值得注意的是,如果还想使用“xrange”,则需要有一个2000年基准时间戳,即设置2020-11年的xrange[1605049200-946684800:-11@Marki,如果使用
设置扩展数据时间
设置时间“%Y-%m-%d%H:%m:%S”
,也可以执行
设置xrange['2020-11-11 00:00:00':]
似乎就是这样,谢谢。值得注意的是,如果还想使用“xrange”,则需要有一个2000年基准时间戳,即设置2020-11年的xrange[1605049200-946684800:-11@Marki,如果使用
设置扩展数据时间
设置时间“%Y-%m-%d%H:%m:%S”
,也可以执行
设置xrange['2020-11-11 00:00:00':]