Gnuplot按天分组 [英] Gnuplot group by days

查看:54
本文介绍了Gnuplot按天分组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以每天绘制一个条形图,其中日值由给定日期中所有值的总和组成?如果可以,是否可以将每个求和"条划分为其求和分量?

Is it possible to plot one bar per each day, where day value consists of sum of all values in the given day? And if yes, is it possible to divide each "sum" bar into its sum components?

数据

2017-09-25 13:56:51 10
2017-09-25 13:56:53 20
2017-09-25 19:20:53 30
2017-09-26 11:56:53 40
2017-09-26 13:17:02 20
2017-09-27 12:56:53 10
2017-09-28 09:56:54 30
2017-09-28 23:56:54 50

以及所需的输出

80                                           B
70                                           B
60       C           B                       B
50       C           B                       B
40       C           A                       B
30       B           A                       A
20       B           A                       A
10       A           A           A           A
 0   2017-09-25  2017-09-26  2017-09-27  2017-09-28

颜色不必在所有列中都相同,只是用于分隔总和分量.

The colors do not have to be same across all columns, it is just for separating the sum components.

到目前为止,我已经设法仅绘制了条形图,每个条形图每个条形图:

So far I have managed to plot just the bars, each per record:

set title "Durations sum per day"
unset multiplot
set xdata time
set style data boxes
set timefmt "%Y-%m-%d %H:%M:%S"
set format x "%m-%d\n%H:%M"
set xlabel "Day"
set ylabel "Duration sum"
set autoscale y
plot "my-data" using 1:3 t "duration [s]" with impulses linewidth 10

推荐答案

您只需忽略绘图时间,而仅使用日期

You simply ignore the time for your plot and only use the date

plot dataf us (timecolumn(1,"%Y-%m-%d")):3 smooth freq with imp

在其他情况下应该可以工作

and in the other case this should work

stats dataf us (timecolumn(1,"%Y-%m-%d"))
set style histogram columnstacked
plot for [i=STATS_min:STATS_max:60*60*24] dataf us (timecolumn(1,"%Y-%m-%d")==i?$3:NaN) w imp lw 10 title strftime("%Y-%m-%d",i)

但是以某种方式"columnstacked"不适用于"[]的情节"

but somehow "columnstacked" does not work with "plot for []"

这篇关于Gnuplot按天分组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆