GNUplot在日期绘图上引发错误

时间:2018-08-22 20:47:35

标签: linux gnuplot

今天,我想以一种自动化的方式来计算特定时间范围内的动作,但是GNUplot抛出了此错误:

"today.p", line 10: x range is invalid

today.p具有以下选项:

set datafile separator ","
set autoscale fix
set style data lines
set key outside right center
set timefmt '"%y-%m-%d %H:%M:%S"'
set format x '%H'
set title "Product Key Generation "
set output 'test.png'
set term png
plot 'result.csv' u 1:($1) title "Product Keys" with lines

result.csv如下:

productkey,activatedat
ACHIZ-wYMIV-UQaHO-mwabr,"2018-08-22 00:00:01"
NWUBO-cLcTr-L4Ia6-llvyw,"2018-08-22 00:00:01"
VXWGQ-UKHao-kq2j1-avuka,"2018-08-22 00:00:01"
NVVFK-3mz8v-27avd-lztgm,"2018-08-22 00:00:01"
PGSRV-oQ2G3-afGRg-kxzob,"2018-08-22 00:00:01"
BULEL-CU1bE-GWxRf-hucwa,"2018-08-22 00:00:01"
ANKWL-LBW8B-il3tM-zzklf,"2018-08-22 00:00:01"
ZSDVL-tZcdY-YRJJQ-ddctr,"2018-08-22 00:00:01"
ZSQLX-pmAp2-Dp3h9-ejtfu,"2018-08-22 00:00:01"
IWKUL-hFhDs-GPapK-fwgmr,"2018-08-22 00:00:01"
GSYAU-eIUjm-2h4O1-gfmmf,"2018-08-22 00:00:01"
OQTDJ-rXkyz-bt18d-skfvp,"2018-08-22 00:00:01"
EKTMD-uOUbA-XEWtP-gyfac,"2018-08-22 00:00:01"
DCPWO-H98qT-FSdZU-qbbqh,"2018-08-22 00:00:01"
ZXSMC-AsiRf-6zkwv-aidor,"2018-08-22 00:00:01"
OGJLE-NyTxe-HuJK5-dwtty,"2018-08-22 00:00:01"
FZETE-BTTA4-W0I0p-bmxah,"2018-08-22 00:00:01"

我只是不知道这里出了什么问题。 Google对此结果一无所获,我对GNUplot还是很陌生

1 个答案:

答案 0 :(得分:0)

您需要修复时间格式(加引号,错误的年份格式),然后

set timefmt "%Y-%m-%d %H:%M:%S"
plot 'result.csv' using 2:(1.0) smooth frequency with lines

这将对第2列中具有相同x坐标(时间)的每个条目添加(1.0)计数。