gpt4 book ai didi

linux - Gnuplot 从不同的 CSV 列构造 timefmt?

转载 作者:太空宇宙 更新时间:2023-11-04 10:29:54 25 4
gpt4 key购买 nike

我有以下 csv 文件,其中的列分别代表 hourminuteview count,一天中的每一分钟正好有 1440 个条目。我想使用 gnuplot 绘制它。 (由于 MySQL ONLY FULL GROUP BY,将 HH:MM 放入一列是不可能的。)

"0","0","71"
"0","1","55"
"0","2","56"
...
"23","57","66"
"23","58","70"
"23","59","75"

目前我使用以下命令:

set datafile separator ","
set timefmt "%H,%M"
set xdata time
set xtics format "%H:%M" time font "/:normal,8" rotate by 45 offset -1,-1

时间格式未正确呈现,小时被解释为分钟,而分钟根本不显示。我也试过 set timefmt "\"%H\",\"%M\"" 但没有成功。

x plotting timestamps

两个问题:

  • 如何解析小时:分钟并正确显示?
  • 如果这个数据文件有更多的列并且时间戳不是在第一个而是在第 n 个,那么我如何指定 gnuplot 来渲染它,类似于 using 0:nplot?

最佳答案

使用这个时间格式字符串

set timefmt "%H:%M"

把这个函数放在某处:

catdate(x,y)=sprintf("%d:%d",x,y) 

然后绘制:

plot 'data.dat' u (catdate($1,$2)):($3) w l

关于linux - Gnuplot 从不同的 CSV 列构造 timefmt?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40456389/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com