【发布时间】:2019-11-17 21:45:04
【问题描述】:
我有以下数据,我想绘制它。
#time,load
10,35965.67
15,35233.82
20,35239.05
25,37188.61
30,36622.32
35,36538.27
....
3000,36305.84
在每一行中,第一列是经过的秒数。第二列是每 5 秒的事务总数。
我想这样绘制:
- x 轴:时间。例如 10/15/20/25 ...
- y 轴:交易。
这是我的配置:
set datafile separator ","
set terminal png size 900,400
set title "Transaction/second graph"
set ylabel "Transactions"
set xlabel "Seconds"
set xdata time
set format x "%s"
set key left top
set grid
plot "output.txt" using 0:1 with lines lw 2 lt 3 title 'tps'
所以 Gnuplot 生成的图像是:
此图像在轴上反转。我尝试了不同的解决方案,例如plot using 1:0,但我收到了异常。此外,看起来数据不正确。我不知道 0/60/120 的值是多少……
【问题讨论】:
-
你想要 1:2,而不是 0:1。但是您需要先将
,替换为空格。 -
@choroba 我阅读的教程也显示“1:2”。但我试过了,我收到了一个例外。这就是为什么我改为“0:1”(我的错)。我认为这是因为分隔符。但我已将分隔符设置为逗号。有什么方法可以使用逗号吗?
-
什么异常?设置数据文件分隔符应该可以工作。
-
plot "output.txt" using 1:2 with lines lw 2 lt 3 title 'tps' line 0: x range is invalid这是我的例外。
标签: plot time-series gnuplot