Plot 如何将x轴上的值从实际值移动到轴原点
我将数据打印到如下结构的文件中:Plot 如何将x轴上的值从实际值移动到轴原点,plot,gnuplot,Plot,Gnuplot,我将数据打印到如下结构的文件中: (timestamp MegaBytes) 1487936469 0.003617 1487936470 0.081604 1487936471 0.244869 1487936472 0.322519 1487936473 0.242145 1487936474 0.34596 1487936475 0.385525 1487936476 0.324402 1487936477 0.154996 1487936478 0.24336 1487936479 0.
(timestamp MegaBytes)
1487936469 0.003617
1487936470 0.081604
1487936471 0.244869
1487936472 0.322519
1487936473 0.242145
1487936474 0.34596
1487936475 0.385525
1487936476 0.324402
1487936477 0.154996
1487936478 0.24336
1487936479 0.38952
1487936480 0.46152
...
密谋
using 1:2 with lines lw 3
set xlabel "seconds"; set ylabel "MB"
set format x '%.0f'
绘图很好,但x轴(时间)不好看:是否有gnuplot命令允许我从x范围[
1487936469
,上一个时间戳
]切换到[0
,上一个值
]因此,x轴值将从0
开始,而不是从1487936469
开始?我自己也觉得打五杆很愚蠢,但我是这样解决的:
gnuplot> set grid
gnuplot> set xlabel "seconds"
gnuplot> set ylabel "MB"
我的文件具有.log扩展名:创建要记录的文件列表
gnuplot> list = system('ls *.log')
“u”:使用“w l”:与线条一起使用,“lw”:线条宽度
gnuplot> plot for [file in list] file u 1:2 w l lw 3 title file
此绘图后,设置了特殊变量,请使用以下方法检查:
gnuplot> show variables all
...
GPVAL_DATA_X_MIN = 1487936460.0 <- this is what I wanted
...
好多了!
功劳归于和
gnuplot> MIN=GPVAL_DATA_X_MIN
gnuplot> plot for [file in list] file u ($1-MIN):2 w l lw 3 title file