Linux 配置gnuplot以处理类似excel的时间序列

Linux 配置gnuplot以处理类似excel的时间序列,linux,excel,math,graph,gnuplot,Linux,Excel,Math,Graph,Gnuplot,我正试图用gnuplot绘制一段时间内的事件图。Excel的默认行为生成更可读的图形 我希望我的gnuplot图表看起来像Excel set terminal png size 1200,800 set xdata time set timefmt "%Y-%m-%d_%H-%M" set output "graph.png" set xrange ["2015-02-01_08-54":"2015-02-01_23-20"] set yrange [0:70] set grid set xla

我正试图用gnuplot绘制一段时间内的事件图。Excel的默认行为生成更可读的图形

我希望我的gnuplot图表看起来像Excel

set terminal png size 1200,800
set xdata time
set timefmt "%Y-%m-%d_%H-%M"
set output "graph.png"
set xrange ["2015-02-01_08-54":"2015-02-01_23-20"]
set yrange [0:70]
set grid
set xlabel "24-Hour"
set ylabel "Events"
set title "Events"
plot "events.dat" using 1:2 index 0 title "events" with filledcurves ls 1
我花了很多时间处理源数据和plot.conf,但我不清楚Excel有什么不同之处。

Gnuplot输出:

Excel输出:


Excel使用错误的x比例绘制:它忽略时间值,并将第一列中给定的值作为标签放置在等距x值处

要获得与gnuplot相同的行为,必须使用
xticlabel
将第一列中的值作为tic标签,并使用行号(第0列)作为x值:

set xtics rotate by 90 right noenhanced
plot "events.dat" using 0:2:xticlabel(1) title "events" with filledcurves
现在,这会给你一些不可读的标签,因为太多了。通过一些调整,您可以获得更好的结果:

set terminal pngcairo size 1200,800
set output "graph.png"
set yrange [0:70]
set grid y
set xlabel "24-Hour"
set ylabel "Events"
set xtics out nomirror scale 0.5 rotate by 90 right font ',8' noenhanced
plot "events.dat" using 0:2:xticlabel(int($0) % 5 == 0 ? strcol(1) : '') title "events" with filledcurves


免责声明:请仅使用此脚本了解Excel的功能,而不要复制它,因为它对事件发生的实际时间跨度产生了非常错误的印象

数据集:谢谢!这帮了大忙!