------------------------------------------------------------------------------- help forpieplot-------------------------------------------------------------------------------

Plot pie charts of categorical frequencies

pieplotyvar[xvar] [ifexp] [inrange] [weight] [, {sum|percent}format(%fmt)gap(relativesize)plabelsubopts(plabel_suboptions)graph_pie_options]

aweights,fweights, andpweights are allowed; see weight.

Description

pieplotplots pie charts of categorical frequencies.

pieplotyvarplots a pie chart showing the relative frequencies of the distinct values ofyvar.

pieplotyvarxvarplots a set of pie charts showing the relative frequencies of the distinct values ofyvarfor each distinct value ofxvar.Typically, but not necessarily,

yvarwill be a response or outcome or dependent variable, andxvar, 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 thesumandpercentoptions.As an aid to learning the syntax of the ultimately more flexible command

graph pie, the syntax used to callgraph pieis echoed to the Results window bypieplot.

RemarksThis command is a convenience command providing an alternative to

graphpie, 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.

pieplotoffers an alternative syntax to this third syntax ofgraph pie.A disadvantage of this third syntax is that it is unlike any other

graphsyntax 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)tabulateyvarandgraph pie, over(yvar)ortabulateyvar xvarandgraph pie, over(yvar) by(xvar).pieplotis thus offered as a bridge to ease learning of the third syntax ofgraph pie.A limitation of

pieplotis that it does not offer complete control of the presentation ofindividualpie slice labels. Users desiring such control are encouraged to consider use of the Graph Editor or to switch tographpie, as appropriate.

Optionssumspecifies 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.

percentspecifies 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

sumandpercentmay be specified.

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

gap(relativesize)specifies additional radial distances affecting all slices.

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

graph_pie_optionsare options of graph pie other thanplabel(),over()andby().

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))

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

Also seeOn-line: help for graph pie