我与内部基准测试工具的工作。我使用的gnuplot(gnuplot 4.6 patchlevel 4
)的可视化。
我需要表示结果(方法执行时间几次运行)作为堆叠线图,是这样的:
下面是我摘录.tsv
的数据文件:
Run MethodA MethodB MethodC
1 192 171 152
2 227 178 161
...
10 229 161 149
和脚本我使用:
#!/usr/bin/gnuplot -p
reset
clear
set terminal png size 640,480
set output "timings.png"
set key top left outside horizontal autotitle columnhead
set title "Third-party REST calls"
set xlabel "Run (ordinal)"
set xtics nomirror scale 0
set ylabel "Time (milliseconds)"
set ytics out nomirror
set grid ytics lt 0 lw 1 lc rgb "#bbbbbb"
set style data histogram
set style histogram rowstacked
set style fill solid border -1
set boxwidth 0.75
plot "timings.tsv" using 2:xticlabels(1) , "" using 3, "" using 4
我得到以下结果:
是的,它不是一个折线图,但直方图(我需要代表每个方法的执行时间的百分比)。我需要略有不同的结果(相同的直方图,不是用方框,而是用线连接方框顶部和线下填充),像这样:
我知道使用的方法filledcurve
(例如,在GNUPlot中创建填充堆栈图所述),但是在这种方法中,您需要显式求和。
是否有可能通过绘制填充区域,而不是盒gnuplot
,如转换成柱状图堆叠线图?
您确实需要显式求和,但这不是一个大问题。您可以轻松编写脚本:
firstcol=2
cumulated(i)=((i>firstcol)?column(i)+cumulated(i-1):(i==firstcol)?column(i):1/0)
plot "file.dat" using 1:(cumulated(4)), "" using 1:(cumulated(3)), "" using 1:(cumulated(2))
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句