gnuplot - 在 x 轴上将 unix 时间戳格式化为日期 - 时间

gnuplot -formating unix timestamp on x axis as date - time

我有以下格式的数据:

1609257628 2
1609256682 4
1609255914 1

第一列应该在 x 轴上,并且是 unix 时间戳。有什么方法可以生成格式为“%d.%m.%Y %H:%M”的可读日期,同时在 x 轴上保持数据点相等 space?

我试过了:

set format x "%d.%m.%Y %H:%M"
plot data  u 0:2:xticlabels(1) w l t 

但它什么都不做,绘制时间戳。所以我更简单地尝试了:

set format x "%d.%m.%Y %H:%M"
plot data u 1:2 w l

但是我明白了

Bad format character

无论如何,目标是 plot using 0:2 但与此同时,x tic 应该是某种预定义格式中第一列的相应时间。

查看文档 help strftime 并尝试以下操作:

代码:

### plot timedata equidistant as xtic label
reset session

$Data <<EOD
1609257628 2
1609256682 4
1609255914 1
EOD

myTimeFmt = "%d.%m.%Y %H:%M"

plot $Data u 0:2:xtic(strftime(myTimeFmt,column(1))) w lp pt 7
### end of code

结果: