⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 graph_bar.hlp

📁 是一个经济学管理应用软件 很难找的 但是经济学学生又必须用到
💻 HLP
📖 第 1 页 / 共 5 页
字号:
    The results will be the same as if you typed

{phang3}
	    {cmd:. graph bar} {it:y}{cmd:, over(}{it:newcategoryvariable}{cmd:)} {it:whatever_other_options}

{pmore}
    with a long rather than wide dataset in memory.

{phang}
{cmd:asyvars}
    specifies that the first {cmd:over()} group be treated as {it:yvars}.
    See {help graph bar##remarks3:Treatment of bars} under {hi:Remarks} below.
    {cmd:asyvars} is seldom specified.

{pmore}
    When you specify {cmd:asyvars}, results are the same as if you removed
    the first {cmd:over()} group and introduced multiple {it:yvars}.
    If you previously had {it:k} {it:yvars} and, in your first
    {cmd:over()} category, {it:G} groups, results will be the same as if you
    specified {it:k}*{it:G} yvars and removed the {cmd:over()}.  Anyplace you
    read in the documentation that something is done over the {it:yvars} or
    using the {it:yvars}, it will be done over or using the first {cmd:over()}
    group.

{pmore}
    Suppose that you specified

{phang3}
	    {cmd:. graph bar y, over(group) asyvars} {it:whatever_other_options}

{pmore}
    Results will be the same as if you typed

{phang3}
	    {cmd:. graph bar} {it:y1 y2 y3} ...{cmd:,} {it:whatever_other_options}

{pmore}
    with a wide rather than long dataset in memory.
    Variables {it:y1}, {it:y2}, ..., are sometimes called the virtual
    {it:yvars}.

{phang}
{cmd:percentages}
    specifies that bar heights be based on percentages that {it:yvar_i}
    represents of all the {it:yvars}.  That is,

{phang3}
	    {cmd:. graph bar (mean) inc_male inc_female}

{pmore}
    would produce a chart with bar height reflecting average income.

{phang3}
	    {cmd:. graph bar (mean) inc_male inc_female, percentage}

{pmore}
    would produce a chart with the bar heights being
    100*inc_male/(inc_male+inc_female) and
    100*inc_female/(inc_male+inc_female).

{pmore}
    If you have a single {it:yvar} and want percentages calculated over the
    first {cmd:over()} group, specify the {cmd:asyvars} option.  For instance,

{phang3}
	    {cmd:. graph bar (mean) wage, over(}{it:i}{cmd:) over(}{it:j}{cmd:)}

{pmore}
    would produce a chart where bar heights reflect mean wages.

{phang3}
	    {cmd:. graph bar (mean) wage, over(}{it:i}{cmd:) over(}{it:j}{cmd:) asyvars percentages}

{pmore}
   would produce a chart where bar heights are

	    100*( mean_ij / (Sum_i mean_ij) )

{pmore}
    Option {cmd:stack} is often combined with option {cmd:percentage}.

{phang}
{cmd:stack}
    specifies that the {it:yvar} bars be stacked.

{p 12 40 2}
	    {cmd:. graph bar (mean) inc_male inc_female,}
			{bind:{cmd:over(region) percentage stack}}

{pmore}
    would produce a chart with all bars being the same height, 100%.  Each
    bar would be two bars stacked (percentage of inc_male and percentage of
    inc_female), so the division would show the relative shares of
    inc_male and inc_female of total income.

{pmore}
    To stack bars over the first {cmd:over()} group,
    specify the {cmd:asyvars} option:

{p 12 40 2}
	    {cmd:. graph bar (mean) wage, over(sex) over(region)}
			{bind:{cmd:asyvars percentage stack}}

{phang}
{cmd:cw}
    specifies casewise deletion.  If {cmd:cw} is specified, observations for
    which any of the {it:yvars} are missing are ignored.  The default is
    to calculate the requested statistics using all the data possible.


{title:lookofbar_options}

{phang}
{cmd:outergap(*}{it:#}{cmd:)} and
{cmd:outergap(}{it:#}{cmd:)}
    specify the gap between the edge of the graph to the beginning of the
    first bar and the end of the last bar to the edge of the graph.

{pmore}
    {cmd:outergap(*}{it:#}{cmd:)} specifies that the default be modified.
    Specifying {cmd:outergap(*1.2)} increase the gap by 20%, and
    specifying {cmd:outergap(*.8)} reduces the gap by 20%.

{pmore}
    {cmd:outergap(}{it:#}{cmd:)} specifies the gap as a
    percentage-of-bar-width units.  {cmd:outergap(50)} specifies that the gap
    be half the bar width.

{phang}
{cmd:bargap(}{it:#}{cmd:)}
    specifies the gap to be left between {it:yvar} bars as a
    percentage-of-bar-width units.  The default is {cmd:bargap(0)}, meaning
    bars touch.

{pmore}
    {cmd:bargap()} may be specified as positive or negative numbers.
    {cmd:bargap(10)} puts a small gap between the bars (the precise amount
    being 10% of the width of the bars).  {cmd:bargap(-30)} overlaps the bars
    by 30%.

{pmore}
    Note that {cmd:bargap()} affects only the {it:yvar} bars.  If you want
    to change the gap for the first, second, or third {cmd:over()}
    groups, specify the {it:over_subopt} {cmd:gap()} inside the
    {cmd:over()} itself; see
    {hi:Suboptions for use with over() and yvaroptions()} below.

{phang}
{cmd:intensity(}{it:#}{cmd:)}
and
{cmd:intensity(*}{it:#}{cmd:)}
    specify the intensity of the color used to fill the inside of the bar.
    {cmd:intensity(}{it:#}{cmd:)} specifies the intensity, and
    {cmd:intensity(*}{it:#}{cmd:)} specifies the intensity relative to the
    default.

{pmore}
    By default, the bar is filled with the color of its border, attenuated.
    Specify {cmd:intensity(*}{it:#}{cmd:)}, {it:#}<1, to attenuate it more and
    specify {cmd:intensity(*}{it:#}{cmd:)}, {it:#}>1, to amplify it.

{pmore}
    Specify {cmd:intensity(0)} if you do not want the bar filled at all.
    Specify {cmd:intensity(100)} if you want the bar to have the same
    intensity as the bar's outline.

{phang}
{cmd:lintensity(}{it:#}{cmd:)}
and
{cmd:lintensity(*}{it:#}{cmd:)}
    specify the intensity of the line used to outline the bar.
    {cmd:lintensity(}{it:#}{cmd:)} specifies the intensity, and
    {cmd:lintensity(*}{it:#}{cmd:)} specifies the intensity relative to the
    default.

{pmore}
    By default, the bar is outlined at the same intensity at which it is
    filled or at an amplification of that, which depending on your chosen
    scheme; see {help schemes}.  If you want the bar outlined in the
    darkest possible way, specify {cmd:intensity(255)}.  If you wish simply to
    amplify the outline, specify {cmd:intensity(*}{it:#}{cmd:)}, {it:#}>1, and
    if you wish to attenuate the outline, specify
    {cmd:intensity(*}{it:#}{cmd:)}, {it:#}<1.

{phang}
{cmd:pcycle(}{it:#}{cmd:)}
    specifies how many variables are to be plotted before the {help pstyle} of
    the bars for the next variable begins again at the {cmd:pstyle} of the
    first variable{hline 2}{cmd:p1bar} (with the bars for the variable
    following that using {cmd:p2bar} and so).  Put another way, {it:#}
    specifies how quickly the look of bars is recycled when more than {it:#}
    variables are specified.  The default for most {help schemes} is
    {cmd:pcycle(15)}.

{phang}
{cmd:bar(}{it:#}{cmd:,} {it:barlook_options}{cmd:)}
    specifies the look of the {it:yvar} bars.
    {cmd:bar(1,} ...{cmd:)} refers to the bar associated with the first
    {it:yvar}, {cmd:bar(2,} ...{cmd:)} refers to the bar associated with the
    second, and so on.  The most useful {it:barlook_option} is
    {cmd:color(}{it:colorstyle}{cmd:)}, which sets the color of the bar.  For
    instance, you might specify {cmd:bar(1, color(green))} to make the bar
    associated with the first {it:yvar} green.  See 
    {it:{help colorstyle}} for a list of color choices, and see 
    {it:{help barlook_options}} for information on the other
    {it:barlook_options}.


{title:legending_options}

{phang}
{it:legend_option}
    controls the legend.
    If more than one {it:yvar} is specified, a legend is produced.
    Otherwise, no legend is needed because the {cmd:over()} groups are
    labeled on the categorical {it:x} axis.
    See {it:{help legend_option}}, and see
    {help graph bar##remarks3:Treatment of bars} under {hi:Remarks} below.

{phang}
{cmd:nolabel}
    specifies that, in automatically constructing the legend, the variable
    names of the {it:yvars} be used in preference to "mean of {it:varname}" or
    "sum of {it:varname}", etc.

{phang}
{cmd:yvaroptions(}{it:over_subopts}{cmd:)}
    allows you to specify {it:over_subopts} for the {it:yvars}.  This is
    very rarely done.

{phang}
{cmd:showyvars}
    specifies that, in addition to building a legend, the identities of the
    {it:yvars} be shown on the categorical {it:x} axis.  If
    {cmd:showyvars} is specified, it is typical also to specify
    {cmd:legend(off)}.

{phang}
{cmd:blabel()} allows you to add labels on top of the bars; see
    {it:{help blabel_option}}.


{title:axis_options}

{phang}
{cmd:yalternate} and {cmd:xalternate}
    switch the side on which the axes appear.

{pmore}
    Used with {cmd:graph} {cmd:bar}, {cmd:yalternate} moves the numerical
    {it:y} axis from the left to the right; {cmd:xalternate} moves the
    categorical {it:x} axis from the bottom to the top.

{pmore}
    Used with {cmd:graph} {cmd:hbar}, {cmd:yalternate} moves the numerical
    {it:y} axis from the bottom to the top; {cmd:xalternate} moves the
    categorical {it:x} axis from the left to the right.

{pmore}
    If your scheme by default puts the axes on the opposite sides, then
    {cmd:yalternate} and {cmd:xalternate} reverse their actions.

{phang}
{cmd:exclude0}
    specifies that the numerical {it:y} axis need not be scaled to include 0.

{phang}
{cmd:yreverse}
    specifies that the numerical {it:y} axis have its scale reversed,
    so that it runs from maximum to minimum.  Note that this option
    causes bars to extend down rather than up ({cmd:graph} {cmd:bar}) or
    from right to left rather than from left to right ({cmd:graph} {cmd:hbar}).

{phang}
{it:axis_scale_options}
    specify how the numerical {it:y} axis is scaled and how it looks; see
    {it:{help axis_scale_options}}.  There you will also see
    option {cmd:xscale()} in addition to {cmd:yscale()}.
    Ignore {cmd:xscale()}, which is irrelevant in the case of bar charts.

{phang}
{it:axis_label_options}
    specify how the numerical {it:y} axis is to be labeled.
    The {it:axis_label_options} also allow you to add and suppress
    grid lines;
    see {it:{help axis_label_options}}.
    There you will see that, in addition to options
    {cmd:ylabel()}, {cmd:ytick()}, ..., {cmd:ymtick()},
    options {cmd:xlabel()}, ..., {cmd:xmtick()} are allowed.  Ignore the
    {cmd:x*()} options, which are irrelevant in the case of bar charts.

{phang}
{cmd:ytitle()}
    overrides the default title for the numerical {it:y} axis; see 
    {it:{help axis_title_options}}.  There you will also find option
    {cmd:xtitle()} documented, which is irrelevant in the case of bar charts.


{title:title_and_other options}

{phang}
{cmd:text()}
    adds text to a specified location on the graph; see 
    {it:{help added_text_option}}.  The basic syntax of {cmd:text()} is

	    {cmd:text(}{it:#_y} {it:#_x} {cmd:"}{it:text}{cmd:")}

{pmore}
    {cmd:text()} is documented in terms of twoway graphs.  When used with
    bar charts, the "numeric" {it:x} axis is scaled to run from 0 to 100.

{phang}
{cmd:yline()}
    adds horizontal ({cmd:bar}) or vertical ({cmd:hbar}) lines at specified
    {it:y} values; see {it:{help added_line_options}}.  The {cmd:xline()}
    option, also documented there, is irrelevant in the case of bar charts.
    If your interest is in adding grid lines, see
    {it:{help axis_label_options}}.

{phang}
{it:aspect_option}
    allows you to control the relationship between the height and width of
    a graph's plot region; see {it:{help aspect_option}}.

{phang}
{it:std_options}
    allow you to add titles, control the graph size, save the graph on
    disk, and much more; see {it:{help std_options}}.

{phang}
{cmd:by(}{it:varlist}{cmd:, ...)}
    draws separate plots within a single graph; see {it:{help by_option}}
    and see {help graph bar##remarks16:Use with by()} under {hi:Remarks} below.


{title:Suboptions for use with over() and yvaroptions()}

{phang}
{cmd:relabel(}{it:#} {cmd:"}{it:text}{cmd:"} ...{cmd:)}
    specifies text to override the default category labeling.
    Pretend that variable {cmd:sex} took on two values and you typed

{phang3}
	    {cmd:. graph bar} ...{cmd:,} ... {cmd:over(sex, relabel(1 "Male" 2 "Female"))}

{pmore}
    The result would be to relabel the first value of {cmd:sex} to be "Male" and
    the second value, "Female"; "Male" and "Female" would appear on the
    categorical {it:x} axis to label the bars.  This would be the result,
    regardless of whether variable {cmd:sex} were string or numeric and
    regardless of the codes actually stored in the variable to record sex.

{pmore}
    That is, {it:#} refers to category number, which is determined by sorting
    the unique values of the variable (in this case, {cmd:sex}) and assigning
    1 to the first value, 2 to the second, and so on.  If you are unsure as to
    what that ordering would be, the easy way to find out is to type

	    {cmd:. tabulate sex}

⌨️ 快捷键说明

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