用gnuplot表示单值时间事件的最佳方法?

时间:2016-10-13 10:31:09

标签: gnuplot

我有以下是来自电子传感器的事件数据。简而言之,只要传感器有事件,它就会使用时间戳记录值1。我可以通过plot "/tmp/data" using 1:3 with points用gnuplot绘制这个图,它给出了一堆以时间间隔分组的点(在Y1处)。似乎可以有更好的方式来表示这些数据。你会怎么做这个?

2016-10-12 21:41:54 1 2016-10-12 21:42:00 1 2016-10-12 21:42:09 1 2016-10-12 21:42:14 1 2016-10-12 21:42:25 1 2016-10-12 21:42:31 1 2016-10-12 21:42:36 1 2016-10-12 21:42:41 1 2016-10-12 21:51:35 1 2016-10-12 21:51:41 1 2016-10-12 22:01:03 1

enter image description here

3 个答案:

答案 0 :(得分:1)

这是绝对最好的方式: plot '/tmp/data' using 3 with impulses lw 2

答案 1 :(得分:0)

如果要绘制事件的频率,则还应计算频率(smooth frequency)并将其绘制为直方图。在您的情况下,最简单的分箱方法是在阅读时间列时跳过秒:

set timefmt "%Y-%m-%d %H:%M"
set xdata time
set yrange [0:*]
set format x "%H:%M"
set ylabel "Disconnects per minute"
set boxwidth 60 absolute
set style fill solid noborder
plot "data.dat" using 1:3 with boxes smooth frequency notitle

enter image description here

答案 2 :(得分:0)

我知道有个老问题,但是我喜欢棒棒糖图,您可以使用 impulse point 在gnuplot中进行仿真。

请参阅:https://subscription.packtpub.com/book/big_data_and_business_intelligence/9781849517249/1/ch01lvl1sec24/making-an-impulse-plot

(快到文章结尾了。我见过的看起来最好的棒棒糖并不像文章中那样五彩缤纷,但是您可以搜索与您的口味相匹配的示例。)

enter image description here

来自此处的图片:https://datavizproject.com/data-type/lollipop-chart/