|
From: David L. <da...@la...> - 2015-03-09 19:01:56
|
I'm using the following script to generate pie charts for each line in a file.
The problem is that the legend at the bottom ends up just having three solid
black circles instead of colored circles.
I'm using gnuplot v5.0 (compiled from source)
What can I do to fix this?
linecount = "`cut -f 1 -d '|' site_summary.data |uniq| sed s/$/' '/ |wc -l`"
sitecount = value("linecount")-1
set term svg size (sitecount * 250),300 dynamic noenhanced
unset tics
unset border
unset colorbox
set key autotitle columnheader
set key center bottom horizontal samplen 5
set xrange [-(125*sitecount):(125*sitecount)]
set yrange [-150:150]
set angles degree
x=0
y=0
r=100.0
set datafile separator "|"
set style fill transparent solid 1.0 noborder
set linetype 1 lc "green" lw 5 pt 3 ps 3
set linetype 2 lc "blue" lw 5 pt 3 ps 3
set linetype 3 lc "orange" lw 5 pt 3 ps 3
set linetype 4 lc "red" lw 5 pt 3 ps 3
set multiplot
plot for [i=4:6] "site_summary.data" u (x+(column(0)-1)*250):(y):(r):(360*(sum [col=4:(i-1)] column(col))/(sum [col=4:6] column(col))):(360*(sum [col=4:i] column(col))/(sum [col=4:6] column(col))):(i-2) title columnhead(i) with circles lc var
plot for [i=4:6] "" u (x+(column(0)-1)*250+(r*1.1)*cos(360*((sum [col=4:(i-1)] column(col))+ column(i)/2.0)/(sum [col=4:6] column(col)))):(y+(r*1.1)*sin(360*((sum [col=4:(i-1)] column(col))+ column(i)/2.0)/(sum [col=4:6] column(col)))):i with labels notitle
plot "" skip 1 u (x+(column(0)-1)*250):(y+(r*1.5)):1 with labels notitle
plot "" skip 1 u (x+(column(0)-1)*250):(y+(r*1.3)):(gprintf("~%.0f systems",$3)) with labels notitle
example data
Site|Date|Systems|Moderate|Severe|Critical
Corp|2015-03-01|700|9000|2000|500
DC1|2015-03-01|500|6000|400|60
DC1|2015-03-01|300|5000|300|50
|