summaryrefslogtreecommitdiffstats
path: root/src/plot_pie
diff options
context:
space:
mode:
authorandmarti1424 <andmarti@gmail.com>2017-04-28 19:02:23 -0300
committerandmarti1424 <andmarti@gmail.com>2017-04-28 19:02:23 -0300
commit2a883e94dd75b0d40eae11a08d3df6951e5c6758 (patch)
tree2c2ae99b95b6d1725f294ace44df2e312b93fc5a /src/plot_pie
parentc00342ef22c3155611bcc28ddef33e341aa990c8 (diff)
Renamed plot files. Fix when pausing and resuming ncurses ui.
Diffstat (limited to 'src/plot_pie')
-rw-r--r--src/plot_pie37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/plot_pie b/src/plot_pie
new file mode 100644
index 0000000..b63a8f4
--- /dev/null
+++ b/src/plot_pie
@@ -0,0 +1,37 @@
+#set terminal dumb enhanced
+set terminal caca driver ncurses color enhanced size 80,43 inverted charset ascii
+set datafile separator ','
+stats filename u 2 noout # get STATS_sum (sum of column 2)
+
+ang(x)=x*360.0/STATS_sum # get angle (grades)
+perc(x)=x*100.0/STATS_sum # get percentage
+
+
+set palette color
+set size square # square canvas
+set xrange [-1:1.5]
+set yrange [-1.25:1.25]
+set style fill solid 1
+
+unset border
+unset tics
+unset key
+
+set linetype 1 linecolor rgb 'red'
+set linetype 2 linecolor rgb 'green'
+set linetype 3 linecolor rgb 'blue'
+set linetype 4 linecolor rgb 'cyan'
+set linetype 5 linecolor rgb 'magenta'
+set linetype 6 linecolor rgb 'white'
+set linetype 7 linecolor rgb 'yellow'
+set linetype 8 linecolor rgb 'orange'
+
+Ai = 0.0; Bi = 0.0; # init angle
+mid = 0.0; # mid angle
+i = 0; j = 0; # color
+yi = 0.0; yi2 = 0.0; # label position
+
+plot filename u (0):(0):(1):(Ai):(Ai=Ai+ang($2)):(i=i+1) with circle linecolor var,\
+filename u (1.5):(yi=yi+0.5/STATS_records):($1) w labels,\
+filename u (1.0):(yi2=yi2+0.5/STATS_records):(j=j+1) w p pt 5 ps 2 linecolor var,\
+filename u (mid=Bi+ang($2)*pi/360.0, Bi=2.0*mid-Bi, 0.5*cos(mid)):(0.5*sin(mid)):(sprintf('%.0f (%.1f\%)', $2, perc($2))) w labels