graph_pie.hlp

来自「是一个经济学管理应用软件 很难找的 但是经济学学生又必须用到」· HLP 代码 · 共 715 行 · 第 1/2 页

HLP
715
字号
{smcl}
{* 05mar2005}{...}
{cmd:help graph pie}{right:dialogs:  {bf:{dialog pie:graph pie}}{space 14}}
{right:{dialog epie1:easy pie (by variables)}}
{right:{dialog epie2:easy pie (by category)} }
{hline}
{* index pie charts}{...}

{title:Title}

{p2colset 5 22 24 2}{...}
{p2col :{hi:[G] graph pie} {hline 2}}Pie charts{p_end}
{p2colreset}{...}


{title:Syntax}

{p 4 6 2}
Slices as totals or percentages of each variable

{p 8 23 2}
{cmdab:gr:aph} {cmd:pie} {varlist} {ifin} {weight} [{cmd:,} {it:options}]

{p 4 6 2}
Slices as totals or percentages within {cmd:over()} categories

{p 8 23 2}
{cmdab:gr:aph} {cmd:pie} {varname} {ifin} {weight}{cmd:,} 
	{cmd:over(}{varname}{cmd:)} [{it:options}]

{p 4 6 2}
Slices as frequencies within {cmd:over()} categories

{p 8 23 2}
{cmdab:gr:aph} {cmd:pie} {ifin} {weight}{cmd:,} 
	{cmd:over(}{varname}{cmd:)} [{it:options}]


{p2colset 9 39 42 2}{...}
	{it:options}{col 40}description
	{hline 70}
	{cmd:over(}{it:varname}{cmd:)}{...}
{col 40}slices are distinct values of {it:varname}
	{cmdab:miss:ing}{...}
{col 40}do not ignore missing values of {it:varname}
	{cmdab:allc:ategories}{...}
{col 40}include all categories in the dataset

	{cmd:cw}{...}
{col 40}casewise treatment of missing values

	{cmdab:nocl:ockwise}{...}
{col 40}counterclockwise pie chart
{p2col :{cmdab:ang:le0(}{it:#}{cmd:)}}{...}
     angle of first slice; default is {cmd:angle(90)}{p_end}

	{cmd:sort}{...}
{col 40}put slices in size order
	{cmd:sort(}{it:varname}{cmd:)}{...}
{col 40}put slices in {it:varname} order
	{cmdab:des:cending}{...}
{col 40}reverse default or specified order

	{cmdab:p:ie:(...)}{...}
{col 40}look of slice, including explosion
	{cmdab:pl:abel(...)}{...}
{col 40}labels to appear on the slice
	{cmdab:pt:ext:(...)}{...}
{col 40}text to appear on the pie
	{cmdab:i:ntensity(}[{cmd:*}]{it:#}{cmd:)}{...}
{col 40}color intensity of slices
	{cmdab:li:ne(}{it:{help line_options}}{cmd:)}{...}
{col 40}outline of slices

	{bf:{help legend_option:legend(...)}}{...}
{col 40}legend explaining slices
	{it:{help std_options}}{...}
{col 40}titles, saving to disk

	{help by_option:{bf:by(}{it:varlist}{bf:, ...)}}{...}
{col 40}repeat for subgroups
	{hline 70}

{pstd}
The syntax of the {cmd:pie()} option is

{pin}
{cmdab:p:ie:(}{c -(}{it:numlist}|{cmd:_all}{c )-}
[{cmd:,}
{it:pie_subopts}]{cmd:)}

	{it:pie_subopts}{col 40}description
	{hline 70}
	{cmd:explode}{...}
{col 40}explode slice by {it:relativesize}=3.8
	{cmd:explode(}{it:{help relativesize}}{cmd:)}{...}
{col 40}explode slice by {it:relativesize}
	{cmdab:c:olor(}{it:{help colorstyle}}{cmd:)}{...}
{col 40}color of slice
	{hline 70}

{pstd}
The syntax of the {cmd:plabel()} option is

{pin}
{cmdab:pl:abel:(}{c -(}{it:#}|{cmd:_all}{c )-}
{c -(}{cmd:sum}|{cmdab:per:cent}|{cmd:name}|{cmd:"}{it:text}{cmd:"}{c )-}
[{cmd:,} {it:plabel_subopts}]{cmd:)}

	{it:plabel_subopts}{col 40}description
	{hline 70}
	{cmdab:for:mat:(}{help format:{bf:%}{it:fmt}}{cmd:)}{...}
{col 40}display format for {cmd:sum} or {cmd:percent}
	{cmd:gap(}{it:{help relativesize}}{cmd:)}{...}
{col 40}additional radial distance
	{it:{help textbox_options}}{...}
{col 40}look of label
	{hline 70}

{pstd}
The syntax for the {cmd:ptext()} option is

{pin}
{cmdab:pt:ext:(}{it:#_a}
{it:#_r}
{cmd:"}{it:text}{cmd:"}
[{cmd:"}{it:text}{cmd:"} ...]
[{it:#_a} {it:#_r} ...]
[{cmd:,} {it:ptext_subopts}]{cmd:)}

	{it:ptext_subopts}{col 40}description
	{hline 70}
	{it:{help textbox_options}}{...}
{col 40}look of added text
	{hline 70}

{pstd}
{cmd:aweight}s, {cmd:fweight}s, and {cmd:pweight}s are
allowed; see {help weight}.


{title:Description}

{pstd}
{cmd:graph} {cmd:pie} draws pie charts.

{pstd}
{cmd:graph} {cmd:pie} has three modes of operation.  The first corresponds
to the specification of two or more variables:

{phang2}
	{cmd:. graph pie div1_revenue div2_revenue div3_revenue}

{pstd}
Three pie slices are drawn, the first corresponding to the sum of variable
div1_revenue, the second to the sum of div2_revenue, and the
third to the sum of div3_revenue.

{pstd}
The second mode of operation corresponds to the specification of a single
variable and the {cmd:over()} option:

	{cmd:. graph pie revenue, over(division)}

{pstd}
Pie slices are drawn for each value of variable division; the first slice
corresponds to the sum of revenue for the first division, the second to the
sum of revenue for the second division, and so on.

{pstd}
The third mode of operation corresponds to the specification of {cmd:over()}
with no variables:

	{cmd:. graph pie, over(popgroup)}

{pstd}
Pie slices are drawn for each value of variable popgroup; the slices
correspond to the number of observations in each group.


{title:Options}

{phang}
{cmd:over(}{it:varname}{cmd:)}
    specifies a categorical variable to correspond to the pie slices.
    {it:varname} may be string or numeric.

{phang}
{cmd:missing}
    is for use with {cmd:over()}; it specifies that missing values of
    {it:varname} not be ignored.  Instead, separate slices are to
    be formed for {it:varname}=={cmd:.}, {it:varname}=={cmd:.a}, ..., or
    {it:varname}=="".

{phang}
{cmd:allcategories}
    specifies that all categories in the entire dataset be retained for the
    {cmd:over()} variables.  When {cmd:if} or {cmd:in} are specified without
    {cmd:allcategories}, the graph is drawn completely excluding any
    categories for the {cmd:over()} variables that do not occur in the
    specified subsample.  With the {cmd:allcategories} option, categories that
    do not occur in the subsample still appear in the legend, and zero-height
    bars are drawn where these categories would appear.  Such behavior can be
    convenient when comparing graphs of subsamples that do not include
    completely common categories for all {cmd:over()} variables.  This option
    has an effect only when {cmd:if} or {cmd:in} are specified or if there are
    missing values in the variables.  {cmd:allcategories} may not be combined
    with {cmd:by()}.

{phang}
{cmd:cw}
    specifies casewise deletion and is for use when {cmd:over()} is
    not specified.  {cmd:cw} specifies that, in calculating the sums,
    observations be ignored for which any of the variables in {it:varlist}
    contain missing values.  The default is to calculate sums
    for each variable using all nonmissing observations.

{phang}
{cmd:noclockwise}
and
{cmd:angle0(}{it:#}{cmd:)}
    specify how the slices are oriented on the pie.  The default is
    to start at 12 o'clock (known as {cmd:angle(90)}) and to proceed clockwise.

{pmore}
    {cmd:noclockwise} causes slices to be placed counterclockwise.

{pmore}
    {cmd:angle0(}{it:#}{cmd:)} specifies the angle at which the first
    slice is to appear.  Angles are recorded in degrees and measured in the
    usual mathematical way:  counterclockwise from the horizontal.

{phang}
{cmd:sort},
{cmd:sort(}{it:varname}{cmd:)}, and
{cmd:descending}
    specify how the slices are to be ordered.  The default is to put the
    slices in the order specified; see
    {help graph pie##remarks4:How slices are ordered} under {hi:Remarks} below.

{pmore}
    {cmd:sort} specifies that the smallest slice be put first, followed
    by the next largest, etc.  See
    {help graph pie##remarks5:Ordering slices by size} under {hi:Remarks} below.

{pmore}
    {cmd:sort(}{it:varname}{cmd:)} specifies that the slices be put in
    (ascending) order of {it:varname}.  See
    {help graph pie##remarks6:Reordering the slices} under {hi:Remarks} below.

{pmore}
    {cmd:descending}, which may be specified whether or not {cmd:sort} or
    {cmd:sort(}{it:varname}{cmd:)} is specified, reverses the order.

{phang}
{cmd:pie(}{c -(}{it:numlist}|{cmd:_all}{c )-}{cmd:,} {it:pie_subopts}{cmd:)}
    specifies the look of a slice or of a set of slices.
    This option allows you to "explode" (offset) one or more slices
    of the pie and to control the color of the slices.  Examples include

{phang2}
	    {cmd:. graph pie ..., ... pie(2, explode)}

{phang2}
	    {cmd:. graph pie ..., ... pie(2, explode color(red))}

{phang2}
	    {cmd:. graph pie ..., ... pie(2, explode color(red)) pie(5, explode)}

{pmore}
    {it:numlist} specifies the slices; see {it:{help numlist}}.
    The slices (after any sorting) are referred to as slice 1, slice 2,
    etc.  {cmd:pie(1} ...{cmd:)} would change the look of the first slice.
    {cmd:pie(2} ...{cmd:)} would change the look of the second slice.
    {cmd:pie(1 2 3} ...{cmd:)} would change the look of the first through
    third slices, as would {cmd:pie(1/3} ...{cmd:)}.  The {cmd:pie()} option
    may be specified more than once to specify a different look for different
    slices.   Alternatively, you may specify {cmd:pie(_all} ...{cmd:)}
    to specify a common characteristic for all slices.

{pmore}
    The {it:pie_subopts} are {cmd:explode},
    {cmd:explode(}{it:relativesize}{cmd:)}, and
    {cmd:color(}{it:colorstyle}{cmd:)}.

{pmore}
    {cmd:explode} and {cmd:explode(}{it:relativesize}{cmd:)} specify that
    the slice is to be offset.  Specifying {cmd:explode} is equivalent
    to specifying {cmd:explode(3.8)}.
    {cmd:explode(}{it:relativesize}{cmd:)} specifies by how much
    (measured radially) the slice is to be offset; see 
    {it:{help relativesize}}.

{pmore}
    {cmd:color(}{it:colorstyle}{cmd:)} sets the color of the slice.
    See {it:{help colorstyle}} for a list of color choices.

{phang}
{cmdab:pl:abel:(}{c -(}{it:#}|{cmd:_all}{c )-}
{c -(}{cmd:sum}|{cmdab:per:cent}|{cmd:name}|{cmd:"}{it:text}{cmd:"}{c )-}{cmd:,} {it:plabel_subopts}{cmd:)}
    specifies labels to appear on the 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 of
    {cmd:plabel()} as

		     {it:which              what                   how}
		    {hline 7}   {hline 25}   {hline 14}
	    {cmd:plabel(} {c -(}{it:#}|{cmd:_all}{c )-}  {c -(}{cmd:sum}|{cmd:percent}|{cmd:name}|{cmd:"}{it:text}{cmd:"}{c )-} {cmd:,} {it:plabel_subopts} {cmd:)}
		    {hline 3}{c TT}{hline 3}   {hline 12}{c TT}{hline 12}   {hline 7}{c TT}{hline 6}
		       {c |}                  {c |}                      {c |}
	 {hline 14}{c BT}{hline 5}             {c |}            {hline 10}{c BT}{hline 13}
	 which slice to label             {c |}            how the label is to look
					  {c |}
			      {hline 12}{c BT}{hline 16}
			      what to label the slice with:
				{cmd:sum}       sum of variable
				{cmd:percent}   percent of sum
				{cmd:name}      identity
				{cmd:"}{it:text}{cmd:"}    text specified

{pmore}
    Thus you might type

	    {cmd:. graph pie} ...{cmd:,} ... {cmd:plabel(_all sum)}

	    {cmd:. graph pie} ...{cmd:,} ... {cmd:plabel(_all percent)}

	    {cmd:. graph pie} ...{cmd:,} ... {cmd:plabel(1 "New appropriation")}

{pmore}
    The {cmd:plabel()} option may appear more than once, so you might also
    type

	    {cmd:. graph pie} ...{cmd:,} ... {cmd:plabel(1 "New appropriation") plabel(2 "old")}

{pmore}
    If you choose to label the slices with their identities, you will probably
    also want to suppress the legend:

	    {cmd:. graph pie} ...{cmd:,} ... {cmd:plabel(_all name) legend(off)}

{pmore}
    The {it:plabel_subopts} are {cmd:format(%}{it:fmt}{cmd:)},
    {cmd:gap(}{it:relativesize}{cmd:)}, and {it:textbox_options}.

{pmore}
    {cmd:format(%}{it:fmt}{cmd:)} specifies the display format to be used
    to format the number when {cmd:sum} or {cmd:percent} is chosen;
    see {help format}.

{pmore}
    {cmd:gap(}{it:relativesize}{cmd:)}
    specifies a radial distance from the origin by which the usual location
    of the label is to be adjusted.
    {cmd:gap(0)} is the default.
    {cmd:gap(}{it:#}{cmd:)}, {it:#<0}, moves the text inward.
    {cmd:gap(}{it:#}{cmd:)}, {it:#>0}, moves the text outward.
    See {it:{help relativesize}}.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?