Saturday, December 29, 2012

Pie charting with gnuplot

In two of my previous posts (post-1 post-2), I have talked about how to plot a pie chart using gnuplot. This time I will introduce a new method witch is much more simpler.

This new method will use the plotstyle "circle". And this feather is not provide since gnuplot version 4.6. So you have to update your gnuplot to a version not lower than 4.6.

set term post eps color enhanced size 5cm,5cm
set output "pie_chart.eps"

set size square
set xrange [-1:1]
set yrange [-1:1]
set style fill solid 1

unset border
unset tics
unset key

plot '-' with circle linecolor var
0 0 1 0   30  1
0 0 1 30  60  2
0 0 1 60  120 3
0 0 1 120 190 4
0 0 1 190 275 5
0 0 1 275 360 6
e
##the first two numbers 0 0 are the
# x and y coordinate of center
##the third number 1 is the radius
#of the circle
##the fourth and fifth number are the
#begin and end angle of the sector
##the last number is the color indicate

set output

Fig.1 Pie charting using gnuplot

Creative Commons License
Except as otherwise noted, the content of this page is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.