我有很多这样的数据
callr | method | call_count | day
------+-------------------------+------------
foo | find_paths | 10 | 2016-10-10
bar | find_paths | 100 | 2016-10-10
foo | find_all | 123 | 2016-10-10
foo | list_paths | 2243 | 2016-10-10
foo | find_paths | 234 | 2016-10-11
foo | collect | 200 | 2016-10-11
bar | collect | 1 | 2016-10-11
baz | collect | 3 | 2016-10-11
... ... ... ...
我想为每种方法创建一个堆叠直方图,显示底部的连续天数和每天的堆叠条形图,其中包含调用者和调用次数。
如果我转换数据,例如
select method, sum(call_count), day from foo where method='collect' group by method, day order by method, day;
我可以获得一个条形图,其中包含一种颜色的一种方法的所有调用,带有这样的 plg 文件,例如:
set terminal png
set title "Method: " . first_arg
set output "" . first_arg . ".png"
set datafile separator '|'
set style data boxes
set style fill solid
set boxwidth 0.5
set xdata time
set timefmt "%Y-%m-%d"
set format x "%a %m-%d"
xstart="2016-10-01"
xend="2017-01-01"
set xrange [xstart:xend]
set xlabel "Date" tc ls 8 offset -35, -3
set ylabel "Calls" tc ls 8
plot '<cat' using 3:4
像这样调用:
cat file | gnuplot -p -e "plot '<cat';first_arg='collect'" calls.plg
但是,我真正想要的是一种在同一种图表中显示调用者细分的方法。我还无法使用 gnuplot 获得堆叠直方图。我尝试过的所有内容都抱怨 using 语句,例如“需要完全使用 x 时间数据的规范”等。
想要这样的东西,但随着底部的日子连续不断。例如,如果那天没有打电话 - 那么没有直方图条
谢谢你的任何想法