Using the data from the previous post, the gnu file would read as follows
reset b=0.4; a=0.4; B=0.5; r=1.0; s=0.1 set view 30, 20; set parametric unset border; unset tics; unset key; unset colorbox set ticslevel 0 set urange [0:1]; set vrange [0:1] set xrange [-2:2]; set yrange [-2:2]; set zrange [0:3] set multiplot set palette model RGB functions 0.9, 0.9,0.95 splot -2+4*u, -2+4*v, 0 w pm3d set palette model RGB functions 0.8, 0.8, 0.85 splot cos(u*2*pi)*v, sin(u*2*pi)*v, 0 w pm3d set palette model RGB functions 0.333333, 0.166667, 0.111111 set urange [0.000000:0.090909] splot cos(u*2*pi)*r, sin(u*2*pi)*r, s+v*a w pm3d splot cos(u*2*pi)*r/2, sin(u*2*pi)*r/2, s+v*a w pm3d set palette model RGB functions 0.666667, 0.333333, 0.222222 set urange [0.090909:0.272727] splot cos(u*2*pi)*r, sin(u*2*pi)*r, s+v*a w pm3d splot cos(u*2*pi)*r/2, sin(u*2*pi)*r/2, s+v*a w pm3d set palette model RGB functions 1.000000, 0.500000, 0.333333 set urange [0.272727:0.454545] splot cos(u*2*pi)*r, sin(u*2*pi)*r, s+v*a w pm3d splot cos(u*2*pi)*r/2, sin(u*2*pi)*r/2, s+v*a w pm3d set palette model RGB functions 0.333333, 0.666667, 0.444444 set urange [0.454545:0.500000] splot cos(u*2*pi)*r, sin(u*2*pi)*r, s+v*a w pm3d splot cos(u*2*pi)*r/2, sin(u*2*pi)*r/2, s+v*a w pm3d set palette model RGB functions 0.666667, 0.833333, 0.555556 set urange [0.500000:0.636364] splot cos(u*2*pi)*r, sin(u*2*pi)*r, s+v*a w pm3d splot cos(u*2*pi)*r/2, sin(u*2*pi)*r/2, s+v*a w pm3d set palette model RGB functions 1.000000, 1.000000, 0.666667 set urange [0.636364:0.909091] splot cos(u*2*pi)*r, sin(u*2*pi)*r, s+v*a w pm3d splot cos(u*2*pi)*r/2, sin(u*2*pi)*r/2, s+v*a w pm3d set palette model RGB functions 0.333333, 0.166667, 0.777778 set urange [0.909091:1.000000] splot cos(u*2*pi)*r, sin(u*2*pi)*r, s+v*a w pm3d splot cos(u*2*pi)*r/2, sin(u*2*pi)*r/2, s+v*a w pm3d set palette model RGB functions 0.333333, 0.166667, 0.111111 set urange [0.000000:0.090909] splot cos(u*2*pi)*r*v, sin(u*2*pi)*r*v, s+a w pm3d set palette model RGB functions 0.666667, 0.333333, 0.222222 set urange [0.090909:0.272727] splot cos(u*2*pi)*r*v, sin(u*2*pi)*r*v, s+a w pm3d set palette model RGB functions 1.000000, 0.500000, 0.333333 set urange [0.272727:0.454545] splot cos(u*2*pi)*r*v, sin(u*2*pi)*r*v, s+a w pm3d set palette model RGB functions 0.333333, 0.666667, 0.444444 set urange [0.454545:0.500000] splot cos(u*2*pi)*r*v, sin(u*2*pi)*r*v, s+a w pm3d set palette model RGB functions 0.666667, 0.833333, 0.555556 set urange [0.500000:0.636364] splot cos(u*2*pi)*r*v, sin(u*2*pi)*r*v, s+a w pm3d set palette model RGB functions 1.000000, 1.000000, 0.666667 set urange [0.636364:0.909091] splot cos(u*2*pi)*r*v, sin(u*2*pi)*r*v, s+a w pm3d set label 1 "1989" at cos(0.090909*pi)*B+cos(0.090909*pi), sin(0.090909*pi)*B+sin(0.090909*pi) centre set label 2 "1990" at cos(0.363636*pi)*B+cos(0.363636*pi), sin(0.363636*pi)*B+sin(0.363636*pi) centre set label 3 "1991" at cos(0.727273*pi)*B+cos(0.727273*pi), sin(0.727273*pi)*B+sin(0.727273*pi) centre set label 4 "1992" at cos(0.954545*pi)*B+cos(0.954545*pi), sin(0.954545*pi)*B+sin(0.954545*pi) centre set label 5 "1992" at cos(1.136364*pi)*B+cos(1.136364*pi), sin(1.136364*pi)*B+sin(1.136364*pi) centre set label 6 "1993" at cos(1.545455*pi)*B+cos(1.545455*pi), sin(1.545455*pi)*B+sin(1.545455*pi) centre set label 7 "1994" at cos(1.909091*pi)*B+cos(1.909091*pi), sin(1.909091*pi)*B+sin(1.909091*pi) centre set palette model RGB functions 0.333333, 0.166667, 0.777778 set urange [0.909091:1] splot cos(u*2*pi)*v, sin(u*2*pi)*v, a+s w pm3d unset multiplot
However, since you don't want to insert all these numbers by hand, I attach a small script in gawk, that would produce the gnu file for you by the stroke of a key. Here you go:
#!/bin/bash gawk 'BEGIN {i=0} { if($0!~/#/) { label[i] = $1 v[i] = $2 D+= $2 i++ } } END { print "reset" print "b=0.4; a=0.4; B=0.5; r=1.0; s=0.1" print "set view 30, 20; set parametric" print "unset border; unset tics; unset key; unset colorbox" print "set ticslevel 0" print "set urange [0:1]; set vrange [0:1]" print "set xrange [-2:2]; set yrange [-2:2]; set zrange [0:3]" print "set multiplot" print "set palette model RGB functions 0.9, 0.9,0.95" print "splot -2+4*u, -2+4*v, 0 w pm3d" print "set palette model RGB functions 0.8, 0.8, 0.85" print "splot cos(u*2*pi)*v, sin(u*2*pi)*v, 0 w pm3d" d=0.0; for(j=0;j<i;j++) { printf "set palette model RGB functions %f, %f, %f\n", (j%3+1)/3, (j%6+1)/6, (j%9+1)/9 printf "set urange [%f:%f]\n", d, d+v[j]/D print "splot cos(u*2*pi)*r, sin(u*2*pi)*r, s+v*a w pm3d" print "splot cos(u*2*pi)*r/2, sin(u*2*pi)*r/2, s+v*a w pm3d" d+=v[j]/D } d=0.0; for(j=0;j<i-1;j++) { printf "set palette model RGB functions %f, %f, %f\n", (j%3+1)/3, (j%6+1)/6, (j%9+1)/9 printf "set urange [%f:%f]\n", d, d+v[j]/D print "splot cos(u*2*pi)*r*v, sin(u*2*pi)*r*v, s+a w pm3d" d+=v[j]/D } d=v[0]/D; for(j=0;j<i;j++) { printf "set label %d \"%s\" at cos(%f*pi)*B+cos(%f*pi), sin(%f*pi)*B+sin(%f*pi) centre\n", j+1, label[j], d, d, d, d d=d+v[j]/D+v[j+1]/D } printf "set palette model RGB functions %f, %f, %f\n", ((i-1)%3+1)/3, ((i-1)%6+1)/6, ((i-1)%9+1)/9 printf "set urange [%f:1]\n", 1.0-v[i-1]/D print "splot cos(u*2*pi)*v, sin(u*2*pi)*v, a+s w pm3d" print "unset multiplot" }' $1
You don't even need to write the gnu file to disc, you can call the gawk script from gnuplot as
load "<pie3d.sh pie.dat
Now, this is not everything. I have recently seen pie charts that are not full, i.e., the centre is missing, as in this one
It is very easy to hack our gnu file above to achieve something like this: the only thing we have to do is to restrict the dummy variable in the parametric plot, so that instead of 0 to 1, now it runs from 0.5 to 1. However, when doing this, we have got to be a bit careful: that particular dummy variable appears at more than one place, so we have to make sure that the actual range doesn't change where we don't want it to change. The snag is that these ranges are linked to each other. But that shouldn't be a problem! In the script below, I highlighted the places to which we have got to pay particular attention.
reset b=0.4; a=0.4; B=0.5; r=1.0; s=0.1 set view 30, 20; set parametric unset border; unset tics; unset key; unset colorbox set ticslevel 0 set urange [0:1]; set vrange [0.5:1] set xrange [-2:2]; set yrange [-2:2]; set zrange [0:3] set multiplot set palette model RGB functions 0.9, 0.9,0.95 splot -2+4*u, -2+4*(1-v)*2, 0 w pm3d set palette model RGB functions 0.8, 0.8, 0.85 splot cos(u*2*pi)*v, sin(u*2*pi)*v, 0 w pm3d set palette model RGB functions 0.333333, 0.166667, 0.111111 set urange [0.000000:0.090909] splot cos(u*2*pi)*r, sin(u*2*pi)*r, s+(1-v)*a*2 w pm3d splot cos(u*2*pi)*r/2, sin(u*2*pi)*r/2, s+(1-v)*a*2 w pm3d set palette model RGB functions 0.666667, 0.333333, 0.222222 set urange [0.090909:0.272727] splot cos(u*2*pi)*r, sin(u*2*pi)*r, s+(1-v)*a*2 w pm3d splot cos(u*2*pi)*r/2, sin(u*2*pi)*r/2, s+(1-v)*a*2 w pm3d set palette model RGB functions 1.000000, 0.500000, 0.333333 set urange [0.272727:0.454545] splot cos(u*2*pi)*r, sin(u*2*pi)*r, s+(1-v)*a*2 w pm3d splot cos(u*2*pi)*r/2, sin(u*2*pi)*r/2, s+(1-v)*a*2 w pm3d set palette model RGB functions 0.333333, 0.666667, 0.444444 set urange [0.454545:0.500000] splot cos(u*2*pi)*r, sin(u*2*pi)*r, s+(1-v)*a*2 w pm3d splot cos(u*2*pi)*r/2, sin(u*2*pi)*r/2, s+(1-v)*a*2 w pm3d set palette model RGB functions 0.666667, 0.833333, 0.555556 set urange [0.500000:0.636364] splot cos(u*2*pi)*r, sin(u*2*pi)*r, s+(1-v)*a*2 w pm3d splot cos(u*2*pi)*r/2, sin(u*2*pi)*r/2, s+(1-v)*a*2 w pm3d set palette model RGB functions 1.000000, 1.000000, 0.666667 set urange [0.636364:0.909091] splot cos(u*2*pi)*r, sin(u*2*pi)*r, s+(1-v)*a*2 w pm3d splot cos(u*2*pi)*r/2, sin(u*2*pi)*r/2, s+(1-v)*a*2 w pm3d set palette model RGB functions 0.333333, 0.166667, 0.777778 set urange [0.909091:1.000000] splot cos(u*2*pi)*r, sin(u*2*pi)*r, s+(1-v)*a*2 w pm3d splot cos(u*2*pi)*r/2, sin(u*2*pi)*r/2, s+(1-v)*a*2 w pm3d set palette model RGB functions 0.333333, 0.166667, 0.111111 set urange [0.000000:0.090909] splot cos(u*2*pi)*r*v, sin(u*2*pi)*r*v, s+a w pm3d set palette model RGB functions 0.666667, 0.333333, 0.222222 set urange [0.090909:0.272727] splot cos(u*2*pi)*r*v, sin(u*2*pi)*r*v, s+a w pm3d set palette model RGB functions 1.000000, 0.500000, 0.333333 set urange [0.272727:0.454545] splot cos(u*2*pi)*r*v, sin(u*2*pi)*r*v, s+a w pm3d set palette model RGB functions 0.333333, 0.666667, 0.444444 set urange [0.454545:0.500000] splot cos(u*2*pi)*r*v, sin(u*2*pi)*r*v, s+a w pm3d set palette model RGB functions 0.666667, 0.833333, 0.555556 set urange [0.500000:0.636364] splot cos(u*2*pi)*r*v, sin(u*2*pi)*r*v, s+a w pm3d set palette model RGB functions 1.000000, 1.000000, 0.666667 set urange [0.636364:0.909091] splot cos(u*2*pi)*r*v, sin(u*2*pi)*r*v, s+a w pm3d set label 1 "1989" at cos(0.090909*pi)*B+cos(0.090909*pi), sin(0.090909*pi)*B+sin(0.090909*pi) centre set label 2 "1990" at cos(0.363636*pi)*B+cos(0.363636*pi), sin(0.363636*pi)*B+sin(0.363636*pi) centre set label 3 "1991" at cos(0.727273*pi)*B+cos(0.727273*pi), sin(0.727273*pi)*B+sin(0.727273*pi) centre set label 4 "1992" at cos(0.954545*pi)*B+cos(0.954545*pi), sin(0.954545*pi)*B+sin(0.954545*pi) centre set label 5 "1992" at cos(1.136364*pi)*B+cos(1.136364*pi), sin(1.136364*pi)*B+sin(1.136364*pi) centre set label 6 "1993" at cos(1.545455*pi)*B+cos(1.545455*pi), sin(1.545455*pi)*B+sin(1.545455*pi) centre set label 7 "1994" at cos(1.909091*pi)*B+cos(1.909091*pi), sin(1.909091*pi)*B+sin(1.909091*pi) centre set palette model RGB functions 0.333333, 0.166667, 0.777778 set urange [0.909091:1] splot cos(u*2*pi)*v, sin(u*2*pi)*v, a+s w pm3d unset multiplot
Again, it is much easier to do this in a convenient way, so I give my gawk script below.
#!/bin/bash gawk 'BEGIN {i=0} { if($0!~/#/) { label[i] = $1 v[i] = $2 D+= $2 i++ } } END { print "reset" print "b=0.4; a=0.4; B=0.5; r=1.0; s=0.1" print "set view 30, 20; set parametric" print "unset border; unset tics; unset key; unset colorbox" print "set ticslevel 0" print "set urange [0:1]; set vrange [0.5:1]" print "set xrange [-2:2]; set yrange [-2:2]; set zrange [0:3]" print "set multiplot" print "set palette model RGB functions 0.9, 0.9,0.95" print "splot -2+4*u, -2+4*(1-v)*2, 0 w pm3d" print "set palette model RGB functions 0.8, 0.8, 0.85" print "splot cos(u*2*pi)*v, sin(u*2*pi)*v, 0 w pm3d" d=0.0; for(j=0;j<i;j++) { printf "set palette model RGB functions %f, %f, %f\n", (j%3+1)/3, (j%6+1)/6, (j%9+1)/9 printf "set urange [%f:%f]\n", d, d+v[j]/D print "splot cos(u*2*pi)*r, sin(u*2*pi)*r, s+(1-v)*a*2 w pm3d" print "splot cos(u*2*pi)*r/2, sin(u*2*pi)*r/2, s+(1-v)*a*2 w pm3d" d+=v[j]/D } d=0.0; for(j=0;j<i-1;j++) { printf "set palette model RGB functions %f, %f, %f\n", (j%3+1)/3, (j%6+1)/6, (j%9+1)/9 printf "set urange [%f:%f]\n", d, d+v[j]/D print "splot cos(u*2*pi)*r*v, sin(u*2*pi)*r*v, s+a w pm3d" d+=v[j]/D } d=v[0]/D; for(j=0;j<i;j++) { printf "set label %d \"%s\" at cos(%f*pi)*B+cos(%f*pi), sin(%f*pi)*B+sin(%f*pi) centre\n", j+1, label[j], d, d, d, d d=d+v[j]/D+v[j+1]/D } printf "set palette model RGB functions %f, %f, %f\n", ((i-1)%3+1)/3, ((i-1)%6+1)/6, ((i-1)%9+1)/9 printf "set urange [%f:1]\n", 1.0-v[i-1]/D print "splot cos(u*2*pi)*v, sin(u*2*pi)*v, a+s w pm3d" print "unset multiplot" }' $1
Well, this is for today. So long!