Example: biology

Title stata.com graph pie — Pie charts

Pie Pie chartsDescriptionQuick startMenuSyntaxOptionsRemarks and examplesReferencesAlso seeDescriptiongraph piedraws pie piehas three modes of operation. The first corresponds to the specification of two or morevariables:. graph pie div1_revenue div2_revenue div3_revenueThree pie slices are drawn, the first corresponding to the sum of variablediv1revenue, thesecond to the sum ofdiv2revenue, and the third to the sum second mode of operation corresponds to the specification of one variable and theover()option:. graph pie revenue, over(division)Pie slices are drawn for each value of variabledivision; the first slice corresponds to the sumof revenue for the first division, the second to the sum of revenue for the second division, and so third mode of operation corresponds to the specification ofover()with no variables:. graph pie, over(popgroup)Pie slices are drawn for each value of variablepopgroup; the slices correspond to the number ofobservations in each startPie chart with slices that reflect the proportion of observations for each level ofcatvar1graph pie, over(catvar1)As above, but slices reflect the total ofv1for each level ofcatvar1graph pie v1, over(catvar1)As above, but with one pie chart for each level ofcatvar2graph pie v1, over(catvar1) by(catvar2)Size of slices reflects the share of each variable in the total ofv1,v2,v3,v

on the pie. The position of the text is specified by the polar coordinates # a and # r. # a specifies the angle in degrees, and # r specifies the distance from the origin; see[G-4] size. intensity(#) and intensity(*#) specify the intensity of the color used to fill the slices.

Tags:

  Polar

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Transcription of Title stata.com graph pie — Pie charts

1 Pie Pie chartsDescriptionQuick startMenuSyntaxOptionsRemarks and examplesReferencesAlso seeDescriptiongraph piedraws pie piehas three modes of operation. The first corresponds to the specification of two or morevariables:. graph pie div1_revenue div2_revenue div3_revenueThree pie slices are drawn, the first corresponding to the sum of variablediv1revenue, thesecond to the sum ofdiv2revenue, and the third to the sum second mode of operation corresponds to the specification of one variable and theover()option:. graph pie revenue, over(division)Pie slices are drawn for each value of variabledivision; the first slice corresponds to the sumof revenue for the first division, the second to the sum of revenue for the second division, and so third mode of operation corresponds to the specification ofover()with no variables:. graph pie, over(popgroup)Pie slices are drawn for each value of variablepopgroup.

2 The slices correspond to the number ofobservations in each startPie chart with slices that reflect the proportion of observations for each level ofcatvar1graph pie, over(catvar1)As above, but slices reflect the total ofv1for each level ofcatvar1graph pie v1, over(catvar1)As above, but with one pie chart for each level ofcatvar2graph pie v1, over(catvar1) by(catvar2)Size of slices reflects the share of each variable in the total ofv1,v2,v3,v4, andv5graph pie v1 v2 v3 v4 v5As above, and label the first slice with its percentage of the wholegraph pie v1 v2 v3 v4 v5, plabel(1 percent)As above, but label each slice with its percentage of the wholegraph pie v1 v2 v3 v4 v5, plabel(_all percent)12 graph pie Pie chartsAs above, but label each slice with its name in white text and suppress the legendgraph pie v1 v2 v3 v4 v5, plabel(_all name, color(white)) ///legend(off)Order the slices from largest to smallestgraph pie v1 v2 v3 v4 v5, sort descendingExplode the second slicegraph pie v1 v2 v3 v4 v5, pie(2, explode(5))MenuGraphics>Pie chartgraph pie Pie charts 3 SyntaxSlices as totals or percentages of each variablegraph pievarlist[if][in][weight][,options]Slic es as totals or percentages withinover()categoriesgraph pievarname[if][in][weight], over(varname)[options]Slices as frequencies withinover()categoriesgraph pie[if][in][weight], over(varname)[options]optionsDescription over(varname)slices are distinct values ofvarnamemissingdo not ignore missing values ofvarnameallcategoriesinclude all categories in the datasetcwcasewise treatment of missing valuesnoclockwisecounterclockwise pie chartangle0(#)angle of first slice; default isangle(90)sortput slices in size ordersort(varname)put slices invarnameorderdescendingreverse default or specified orderpie(.)

3 Look of slice, including explosionplabel(..)labels to appear on the sliceptext(..)text to appear on the pieintensity([*]#)color intensity of slicesline(lineoptions)outline of slicespcycle(#)slice styles beforepstyles recyclelegend(..)legend explaining slicesstdoptionstitles, saving to diskby(varlist,..)repeat for subgroups over(varname)is required in syntaxes 2 and graph pie Pie chartsThe syntax of thepie()option ispie({numlist|all}[,piesubopts])piesubo ptsDescriptionexplodeexplode slice bysize= (size)explode slice bysizecolor(colorstyle)color and opacity of sliceThe syntax of theplabel()option isplabel({#|all}{sum|percent|name|"text" }[,plabelsubopts])plabelsuboptsDescripti onformat(%fmt)display format forsumorpercentgap(size)additional radial distancetextboxoptionslook of labelThe syntax for theptext()option isptext(#a#r"text"["text"..][#a# ][,ptextsubopts])ptextsuboptsDescription textboxoptionslook of added textaweights,fweights, andpweights are allowed; see[U] (varname)specifies a categorical variable to correspond to the pie be stringor for use withover(); it specifies that missing values ofvarnamenot be ignored.

4 Instead,separate slices are to be formed forvarname==.,varname==.a,.., orvarname=="".allcategoriesspecifies that all categories in the entire dataset be retained for theover() specified withoutallcategories, the graph is drawn, completely excludingany categories for theover()variables that do not occur in the specified subsample. With theallcategoriesoption, categories that do not occur in the subsample still appear in the legend, andzero-sized slices are drawn where these categories would appear. Such behavior can be convenientwhen comparing graphs of subsamples that do not include completely common categories for allover()variables. This option has an effect only wheniforinis specified or if there are missingvalues in the not be combined withby().cwspecifies casewise deletion and is for use whenover()is not that, incalculating the sums, observations be ignored for which any of the variables invarlistcontain missingvalues.

5 The default is to calculate sums for each variable by using all nonmissing pie Pie charts 5noclockwiseandangle0(#)specify how the slices are oriented on the pie. The default is to startat 12 o clock (known asangle(90)) and to proceed slices to be placed (#)specifies the angle at which the first slice is to appear. Angles are recorded in degreesand measured in the usual mathematical way: counterclockwise from the ,sort(varname), anddescendingspecify how the slices are to be ordered. The default isto put the slices in the order specified; seeHow slices are orderedunderRemarks and that the smallest slice be put first, followed by the next largest, etc. SeeOrderingslices by sizeunderRemarks and (varname)specifies that the slices be put in (ascending) order ofvarname. SeeReorderingthe slicesunderRemarks and , which may be specified whether or notsortorsort(varname)is specified, reversesthe ({numlist|all},piesubopts)specifies the look of a slice or of a set of slices.

6 This optionallows you to explode (offset) one or more slices of the pie and to control the color of the include. graph ,..pie(2, explode). graph ,..pie(2, explode color(red)). graph ,..pie(2, explode color(red)) pie(5, explode)numlistspecifies the slices; see[U] numlist. The slices (after any sorting) are referred toas slice 1, slice 2, ( )would change the look of the first ( )wouldchange the look of the second (1 2 )would change the look of the first throughthird slices, as wouldpie(1 ). Thepie()option may be specified more than once tospecify a different look for different slices. You may also specifypie( )to specify acommon characteristic for all ,explode(size), andcolor(colorstyle).explodeandexplode(s ize)specify that the slice be offset. Specifyingexplodeis equivalent tospecifyingexplode( ).explode(size)specifies by how much (measured radially) the sliceis to be offset; see [G-4] (colorstyle)sets the color and opacity of the slice.

7 See [G-4]colorstylefor a list of graph pie Pie chartsplabel({#|all}{sum|percent|name|"t ext"},plabelsubopts)specifies labels to appear onthe slice. Slices may be labeled with their sum, their percentage of the overall sum, their identity,or with text you specify. The default is that no labels appear. Think of the syntax ofplabel()aswhich what howplabel({#|_all} {sum|percent|name|"text"},plabel_subopts )which slice to labelhow the label is to lookwhat to label the slice with:sumsum of variablepercentpercent of sumnameidentity"text"text specifiedThus you might type. graph ,..plabel(_all sum). graph ,..plabel(_all percent). graph ,..plabel(1 "New appropriation")Theplabel()option may appear more than once, so you might also type. graph ,..plabel(1 "New appropriation") plabel(2 "old")If you choose to label the slices with their identities, you will probably also want to suppress thelegend.

8 graph ,..plabel(_all name) legend(off)Theplabelsuboptsareformat(%fm t),gap(size), (%fmt)specifies the display format to be used to format the number whensumorpercentis chosen; see [D] (size)specifies a radial distance from the origin by which the usual location of the label is tobe (0)is the (#),#<0, moves the text (#),#>0, movesthe text outward. See [G-4] the size, color, etc., of the text; see [G-3] (#a#r"text"["text"..][#a# ],ptextsubopts)specifies additional text to appearon the pie. The position of the text is specified by the polar coordinates#aand#r.#aspecifiesthe angle in degrees, and#rspecifies the distance from the origin; see [G-4] (#)andintensity(*#)specify the intensity of the color used to fill the (#)specifies the intensity, andintensity(*#)specifies the intensity relative to (*#),#<1, to attenuate the interior color and specifyintensity(*#),#>1, to amplify (0)if you do not want the slice filled at (lineoptions)specifies the look of the line used to outline the slices.

9 See [G-3]lineoptions,but ignore optionlpattern(), which is not allowed for pie pie Pie charts 7pcycle(#)specifies how many slices are to be plotted before thepstyleof the slices for the next slicebegins again at thepstyleof the first slice p1pie(with the slices following that usingp2pie,p3pie, and so on). Put another way:#specifies how quickly the look of slices is recycled whenmore than#slices are specified. The default for most schemes ispcycle(15).legend()allows you to control the legend. See [G-3] you to add titles, save the graph on disk, and more; see [G-3] (varlist,..)draws separate pies within one graph ; see [G-3]byoptionand seeUse with by( )underRemarks and and are presented under the following headings:Typical useData are summedData may be long rather than wideHow slices are orderedOrdering slices by sizeReordering the slicesUse with by( )Video exampleHistory8 graph pie Pie chartsTypical useWe have been told that the expenditures forXYZCorp.

10 Are $12 million in sales, $14 million inmarketing, $2 million in research, and $8 million in development:. input sales marketing research developmentsales marketing research develop~t1. 12 14 2 82. end. label var sales "Sales". label var market "Marketing". label var research "Research". label var develop "Development". graph pie sales marketing research development,plabel(_all name, size(* ) color(white))(Note 1)legend(off)(Note 2)plotregion(lstyle(none))(Note 3) Title ("Expenditures, XYZ Corp.")subtitle("2002")note("Source: 2002 Financial Report (fictional data)")SalesMarketingResearchDevelopment Source: 2002 Financial Report (fictional data)2002 Expenditures, XYZ :1. We specifiedplabel(all name)to put the division names on the slices. We specifiedplabel() s textbox-optionsize(* )to make the text 50% larger than usual. We specifiedplabel() s textbox-optioncolor(white)to make the text white. See [G-3] We specified the legend-optionlegend(off)to keep the division names from being repeatedin a key at the bottom of the graph ; see [G-3] We specified the region-optionplotregion(lstyle(none))to prevent a border from beingdrawn around the plot area; see [G-3] pie Pie charts 9 Data are summedRather than having the above summary data, we have.


Related search queries