arnaucube
arnaucube/hyperplonkPublic Self-hosted repository
hyperplonk/bench_results/plot_msm
bench_results/plot_msmRaw
 1filename = 'msm_vs_eval.txt' 
 2set terminal postscript eps enhanced color font "18"
 3set size square
 4set output "msm_vs_eval.eps" 
 5
 6rowi = 0
 7rowf = 3
 8
 9# obtain sum(column(2)) from rows `rowi` to `rowf`
10set datafile separator ','
11stats filename u 2 every ::rowi::rowf noout prefix "A"
12
13# rowf should not be greater than length of file
14rowf = (rowf-rowi > A_records - 1 ? A_records + rowi - 1 : rowf)
15
16angle(x)=x*360/A_sum
17percentage(x)=x*100/A_sum
18
19# circumference dimensions for pie-chart
20centerX=0
21centerY=0
22radius=1
23
24# label positions
25yposmin = 0.0
26yposmax = 0.95*radius
27xpos = -0.8*radius
28ypos(i) = -2.2*radius + yposmax - i*(yposmax-yposmin)/(1.0*rowf-rowi)
29
30#-------------------------------------------------------------------
31# now we can configure the canvas
32set style fill solid 1     # filled pie-chart
33unset key                  # no automatic labels
34unset tics                 # remove tics
35unset border               # remove borders; if some label is missing, comment to see what is happening
36
37set size ratio -1              # equal scale length
38set xrange [-radius:radius]  # [-1:2] leaves space for labels
39set yrange [-3*radius:radius]    # [-1:1]
40
41#-------------------------------------------------------------------
42pos = 0             # init angle
43colour = 0          # init colour
44
45# 1st line: plot pie-chart
46# 2nd line: draw colored boxes at (xpos):(ypos)
47# 3rd line: place labels at (xpos+offset):(ypos)
48plot filename u (centerX):(centerY):(radius):(pos):(pos=pos+angle($2)):(colour=colour+1) every ::rowi::rowf w circle lc var,\
49     for [i=0:rowf-rowi] '+' u (xpos):(ypos(i)) w p pt 5 ps 4 lc i+1,\
50     for [i=0:rowf-rowi] filename u (xpos):(ypos(i)):(sprintf('%05.2f%% %s', percentage($2), stringcolumn(1))) every ::i+rowi::i+rowi w labels left offset 3,0