```-------------------------------------------------------------------------------
help for pieplot
-------------------------------------------------------------------------------

Plot pie charts of categorical frequencies

pieplot yvar [xvar] [if exp] [in range] [weight] [, { sum | percent }
format(%fmt) gap(relativesize)
plabelsubopts(plabel_suboptions) graph_pie_options ]

aweights, fweights, and pweights are allowed; see weight.

Description

pieplot plots pie charts of categorical frequencies.

pieplot yvar plots a pie chart showing the relative frequencies of the
distinct values of yvar.

pieplot yvar xvar plots a set of pie charts showing the relative
frequencies of the distinct values of yvar for each distinct value of
xvar.

Typically, but not necessarily, yvar will be a response or outcome or
dependent variable, and xvar, whenever specified, will be an explanatory
or predictor or independent variable.

By default pie slices are named according to the categories of yvar. See
also the sum and percent options.

As an aid to learning the syntax of the ultimately more flexible command
graph pie, the syntax used to call graph pie is echoed to the Results
window by pieplot.

Remarks

This command is a convenience command providing an alternative to graph
pie, over() for pie charts showing categorical frequencies.

graph pie supports three syntaxes. The first two are for calculating pie
charts from sums of supplied variables and are not of concern here. The
third is for counting observations in different categories. pieplot
offers an alternative syntax to this third syntax of graph pie.

A disadvantage of this third syntax is that it is unlike any other graph
syntax in that no variable list is expected. In addition, it is unlike
other syntax that users may issue with categorical variables.  Thus users
must switch between (say) tabulate yvar and graph pie, over(yvar) or
tabulate yvar xvar and graph pie, over(yvar) by(xvar).  pieplot is thus
offered as a bridge to ease learning of the third syntax of graph pie.

A limitation of pieplot is that it does not offer complete control of the
presentation of individual pie slice labels. Users desiring such control
are encouraged to consider use of the Graph Editor or to switch to graph
pie, as appropriate.

Options

sum specifies that pie slices show sums, typically the number of
observations in each category, or more generally the sum of weights
in each category. The default is to show names of categories on each
slice.

percent specifies that pie slices show percents, typically the percent of
observations in each category, or more generally the percent of the
total weight in each category. The default is to show names of
categories on each slice.

Only one of sum and percent may be specified.

format(%fmt) specifies a numeric format controlling the presentation of
sums or percents on all slices.

slices.

plabelsubopts() may be used to specify additional suboptions of graph
pie, plabel() affecting all slices.

graph_pie_options are options of graph pie other than plabel(), over()
and by().

Examples

. sysuse auto, clear
. pieplot rep78
. pieplot rep78 foreign
. pieplot rep78 foreign, sum
. pieplot rep78 foreign, sum plabelsubopts(size(*2))
. pieplot rep78 foreign, sum plabelsubopts(size(*2)) pie(1, color(red*2))
pie(2, color(red)) pie(3, color(red*0.7)) pie(4, color(red*0.5))
pie(5, color(red*0.3)) legend(row(1))

Author

Nicholas J. Cox, Durham University
n.j.cox@durham.ac.uk

Also see

On-line:  help for graph pie

```