piechart(p [,start:p0] [,labels:labs] [,rlab:r1 [, rval:r2]\ [, xwidth:w] [,graphics keyword phrases]), REAL vector p with p[i] >= 0, p0 >= 0, REAL scalar, CHARACTER vector labs, REAL scalars r1 > 0, r2 > 0, w > 0 |

piechart(p) draws a pie chart of data in REAL vector p which should have no MISSING values and satisfy min(p) >= 0. The chart is drawn in a circle with radius 1. Usually p is a vector of proportions (sum(p) = 1) or percentages (sum(p) = 100), but this is not required. What is actually drawn is a pie chart with sector angles computed from the proportions p1 = p/sum(p). The angle defining sector I of the pie chart, going clockwise around the circle is 360*p1[I] degrees. By default, the starting edge of sector 1 is vertical. Each sector is is labelled by sector number, from 1 to nrows(p). There several optional keywords. start piechart(p, start:p0 [,other keywords]) where p0 is a REAL scalar draws a pie chart with the starting sector edge located p0 of a cycle (abs(p0) <= 1) or p0 percent of a cycle (abs(p0) > 1) around the circle from the vertical. For instance, with p0 = .25 or 25, the starting sector edge is 90 degrees clockwise from the vertical. 'start' can be used with other keywords. labels piechart(p, labels:labs [,other keywords]), where labs is a CHARACTER vector with length(labs) = length(p), labels sector I with labs[I]. You can suppress sector labelling with labels:"". rlab piechart(p, rlab:r1 [,labels:labs] [,other keywords]) puts sector labels at radius r1 > 0 from the pie center. Usually r1 < 1. The default radius is .9. rval piechart(p, rval:r2 [,other keywords]), prints p[I] at radius r2 > 0 in sector I, I = 1, ..., length(p). Usually r2 < 1. This allows you to label sectors both with a descriptive tag and the value of the data. xwidth piechart(p, xwidth:w [other keywords]) includes 'xmin:-w/2,xmax:w/2' in the argument list of the plotting commands that draw the pie chart. You need to use 'xwidth' only when the plot without it looks like an ellipse instead of a circle. The default is 'xwidth:3.2'. You can also use many of the usual graphics keywords like 'xlab', 'ylab', 'title' and 'window'. See topic 'graph_keys'. If you don't like the default labeling, you may be able to use Mouse() and addstrings() to position labels more to your liking. See Mouse() and addstrings().

Gary Oehlert 2003-01-15