Sunday, 31 May 2009

Another simple 3D pie chart with gnuplot (script included)

A couple of days ago, I showed how one can draw a very simple 2D pie chart embedded in 3D space in gnuplot. Today we will try our hand at a real 3D pie chart, especially, that we have basically learnt everything that we need in that post. The only extra step required is to draw the side of the cylinder, with the proper colouring. Once we do this, we get a figure similar to this one:



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!

11 comments:

  1. You are right, I haven't published the file. On the other hand, I pointed out somewhere that it is just a two-column file, with the first being the label, the second being the actual data. But if you insist, here is the file that I used, and referred to as pie.dat
    1989 0.1
    1990 0.2
    1991 0.2
    1992 0.05
    1993 0.15
    1994 0.3
    1995 0.1
    Cheers,
    Gnuplotter

    ReplyDelete
  2. I am trying to duplicate your results with Gnuplot 4.4rc1 without much success. If I output this graph as a PNG, I only get text. If I output it as an SVG it looks OK but not anti-aliased in Chrome and Firefox. If I load the SVG into Inkscape, or use ImageMagick to convert it to a PNG, I get some really odd transparency on top that shows the inner circle and some pretty significant moiree (but the lines dividing the slices are nice and smooth.

    What version of Gnuplot are you using?

    ReplyDelete
  3. Hello Alex,

    When I was doing these charts, I used gnuplot 4.2, but I believe that it should work with 4.4. I will try it. However, what you say about the png file is more disturbing. I could get png work on 4.4, in fact, I use that all the time without any problems. Can you produce any png files at all? Can you post the relevant part of your code?
    Cheers,
    Zoltán

    ReplyDelete
  4. I have tried to implement an arbitrary inner radius for the script. It kinda works, although the "lid" of the plot is sometimes too large, sometimes too small (try 0, 0.25, 0.75) in gnuplot 4.4

    Any ideas why this may be happening?
    ___

    #!/bin/bash
    ## pie3dh.sh script
    ## call with pie3dh.sh , where 0 < inner radius < 1
    if [ -z "$2" ]
    then
    v0=0.5
    else
    v0=$2
    echo "set radius to $v0" >&2
    fi

    gawk 'BEGIN {i=0}
    {
    if($0!~/#/) {
    label[i] = $1
    v[i] = $2
    D+= $2
    i++
    }
    }
    END {
    print "reset"
    print "set term postscript enhanced eps color dashed size 5,3.5 24"
    print "set output \"pie.eps\""
    print "b=0.4; a=0.4; B=0.5; r=1.0; s=0.1; v0='$v0';"
    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 [v0:1]"
    print "set xrange [-2:2]; set yrange [-2:2]; set zrange [0:3]"
    print "set isosamples 10,10"
    print "set multiplot"
    print "set palette model RGB functions 0.9, 0.9,0.95"
    print "splot -2+4*u, -2+4*(1-v)/(1-v0), 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/(1-v0) w pm3d"
    print "splot cos(u*2*pi)*r*v0, sin(u*2*pi)*r*v0, s+(1-v)*a/(1-v0) 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"
    print "!gv -scale=3 pie.eps &"

    }' $1

    ReplyDelete
  5. hi all,
    I found this (rather old) post, and attempted to reproduce the sample gnuplot config to get such a 3D pie-chart.
    However my GNUPLOT command yells at me with
    Warning: empty cb range [0:0], adjusting to [-1:1]
    Warning: empty cb range [0:0], adjusting to [-1:1]
    Warning: empty cb range [0.5:0.5], adjusting to [0.495:0.505]
    Warning: empty cb range [0.5:0.5], adjusting to [0.495:0.505]
    Warning: empty cb range [0.5:0.5], adjusting to [0.495:0.505]

    No idea where to start looking, maybe it has to do with the colors, based on what I found in some web articles about the 'cb' axis.

    my gnuplot binary is version 4.4.0, compiled from the source files bundle.

    my config file is :
    reset
    set term postscript enhanced eps color dashed size 5,3.5 24
    set output "/tmp/2011.eps"
    set title "Iaccounts - 2011"
    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 isosamples 10,10
    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.248093]
    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.248093:0.712216]
    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.712216: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.248093]
    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.248093:0.712216]
    splot cos(u*2*pi)*r*v, sin(u*2*pi)*r*v, s+a w pm3d
    set label 1 "BW_QoS_UDF_update" at cos(0.248093*pi)*B+cos(0.248093*pi), sin(0.248093*pi)*B+sin(0.248093*pi)
    centre
    set label 2 "Category I" at cos(0.960310*pi)*B+cos(0.960310*pi), sin(0.960310*pi)*B+sin(0.960310*pi) centre
    set label 3 "Category II" at cos(1.712216*pi)*B+cos(1.712216*pi), sin(1.712216*pi)*B+sin(1.712216*pi) centre
    set palette model RGB functions 1.000000, 0.500000, 0.333333
    set urange [0.712216:1]
    splot cos(u*2*pi)*v, sin(u*2*pi)*v, a+s w pm3d
    unset multiplot

    ReplyDelete
    Replies
    1. set view 0, 0; set parametric
      OR
      set pm3d map; set parametric

      set zrange [0:10]
      set cbrange [0:10]

      Please note, the above errors described have been fixed, but now there are problems with the pie!



      #!/bin/bash

      gawk 'BEGIN {i=0}
      {
      if($0!~/#/) {
      label[i] = $1
      v[i] = $2
      D+= $2
      i++
      }
      }
      END {
      print "reset"
      print "set terminal png medium"
      print "b=0.4; a=0.4; B=0.5; r=1.0; s=0.1"
      #print "set view 0, 0; set parametric"
      print "set pm3d map; set parametric"
      print "set zrange [0:10]"
      print "set cbrange [0:10]"
      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 pie3d.png

      The lack of backwards compatibility support with this software here is epic.

      Delete
  6. Sorry, mistake in the version number of my gnuplot : it is not 4.4.0, but rather 4.4 patchlevel 4 (which thus equals 4.4.4)

    ReplyDelete
  7. I've fixed the pie chart, message me for an updated version (I cannot post it here!)

    Cheers,
    Fletch

    ReplyDelete
  8. Visit http://www.hexafind.com/ to see examples of this very script in operation...

    Thx Zoltan

    ReplyDelete