You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.7 KiB

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