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 |

How would you label each slice?

ReplyDeleteYou can have a loot at http://gnuplot-surprising.blogspot.com/2011/10/pie-chart-in-gnuplot.html where each slice is labeled.

DeleteI did, and ended up just using your python script on that page to do what I needed. I'd really like to use the format on this page as it gives me a little more flexibility when I generate my dataset from the database, but I'm having a hard time getting labels to show up correctly.

DeleteThanks anyway.

label example

Deleteadd 7th column to the data with the labels

plot instruction could then be:

set angles degrees

plot 'datafile' u 1:2:3:4:5:6 with circles lc var, '' u (cos($3+(($4-$3)/2))):(sin($3+(($4-$3)/2))):7 with labels

Great content, used this site for reference for gnuplot quite a bit. Any books or sites you recommend to get really familiar with gnuplot?

ReplyDelete