更改小时格式 gnuplot(减去 12 小时)

change hour format gnuplot (substract 12 hour)

我有两个并行工作的设备,问题是其中一个的设置与另一个不同 12 小时(即,而不是 17:00,标记为 05:00)。 我正在尝试应用此解决方案: How to read 12h (AM/PM) timeformat in gnuplot

这样:我的数据是这样的:

#Time   Concentration (#/cm³)   
05:00:14    5902    
05:00:15    5898    
05:00:16    5989    
05:00:17    5921    

我是 运行 以下代码:

set xdata time
set timefmt '%H:%M:%S'
set format x '%H:%M'  
set xlabel "time"

plot  "< awk '{time = ; if substr(time,1,2) <= 12) add = 12; else add = 0}' data1.txt" u 1:2 t 'CPC1' w l, \
      "data2.txt" u 1:2 t 'CPC2' w l

pause -1

但是,处理后的 data1 文件没有被绘制,只有具有正确时间刻度的 data2 被绘制。有解决方案吗?

提前致谢!

你可以直接在gnuplot里面加上12小时。在 using 语句中使用 timecolumn 获取以秒为单位的时间,然后添加 12 小时(43200 秒)

set xdata time
set timefmt '%H:%M:%S'
set format x '%H:%M'  
set xlabel "time"
set style data lines

plot 'data1.txt' using (timecolumn(1) + 43200):2 t 'CPC1',\
     'data2.txt' using 1:2 t 'CPC2'