📄 graph_box.hlp
字号:
{smcl}
{* 28apr2005}{...}
{cmd:help graph box} {right:dialogs: {bf:{dialog box:graph box}} {dialog ebox:easy graph box} }
{hline}
{* index box plots}{...}
{* index over() tt option}{...}
{* index ascategory() tt option}{...}
{* index asyvars() tt option}{...}
{title:Title}
{p2colset 5 22 24 2}{...}
{p2col :{hi:[G] graph box} {hline 2}}Box plots{p_end}
{p2colreset}{...}
{title:Syntax}
{p 8 23 2}
{cmdab:gr:aph} {cmd:box}{space 2}{it:yvars}
{ifin}
{weight}
[{cmd:,}
{it:options}]
{p 8 23 2}
{cmdab:gr:aph} {cmd:hbox}
{it:yvars}
{ifin}
{weight}
[{cmd:,}
{it:options}]
{phang}
where {it:yvars} is a {it:varlist}
{it:options}{col 40}description
{hline 70}
{help graph box##group_options:{it:group_options}}{...}
{col 40}groups over which boxes are drawn
{help graph box##yvar_options:{it:yvar_options}}{...}
{col 40}variables that are the boxes
{help graph box##boxlook_options:{it:boxlook_options}}{...}
{col 40}how the boxes look
{help graph box##legending_options:{it:legending_options}}{...}
{col 40}how variables are labeled
{help graph box##axis_options:{it:axis_options}}{...}
{col 40}how numerical {it:y} axis is labeled
{help graph box##title_and_other_options:{it:title_and_other_options}}{...}
{col 40}titles, added text, aspect ratio, etc.
{hline 70}
{it:group_options}{marker group_options}{col 40}description
{hline 70}
{cmdab:o:ver:(}{it:varname}[{cmd:,} {help graph box##over_subopts:{it:over_subopts}}]{cmd:)}{...}
{col 40}categories; option may be repeated
{cmd:nofill}{...}
{col 40}omit empty categories
{cmdab:miss:ing}{...}
{col 40}keep missing value as category
{cmdab:allc:ategories}{...}
{col 40}include all categories in the dataset
{hline 70}
{it:yvar_options}{marker yvar_options}{col 40}description
{hline 70}
{cmdab:asc:ategory}{...}
{col 40}treat {it:yvars} as first {cmd:over()} group
{cmdab:asy:vars}{...}
{col 40}treat first {cmd:over()} group as {it:yvars}
{cmdab:cw}{...}
{col 40}calculate variable statistics omitting
{col 40} missing values of any variable
{hline 70}
{it:boxlook_options}{marker boxlook_options}{col 40}description
{hline 70}
{cmdab:noout:sides}{...}
{col 40}do not plot outside values
{cmd:box(}{it:#}{cmd:,} {it:{help barlook_options}}{cmd:)}{...}
{col 40}look of {it:#}th box
{cmdab:pcyc:le:(}{it:#}{cmd:)}{...}
{col 40}box styles before {help pstyle:pstyles} recycle
{cmdab:inten:sity:(}[{cmd:*}]{it:#}{cmd:)}{...}
{col 40}intensity of fill
{cmdab:linten:sity:(}[{cmd:*}]{it:#}{cmd:)}{...}
{col 40}intensity of outline
{cmdab:medt:ype:(line}|{cmd:cline}|{cmd:marker)}{...}
{col 40}how median is indicated in box
{cmdab:medl:ine:(}{it:{help line_options}}{cmd:)}{...}
{col 40}look of line if {cmd:medtype(cline)}
{cmdab:medm:arker:(}{it:{help marker_options}}{cmd:)}{...}
{col 40}look of marker if {cmd:medtype(marker)}
{cmdab:cwhi:skers}{...}
{col 40}use custom whiskers
{cmdab:line:s:(}{it:{help line_options}}{cmd:)}{...}
{col 40}look of custom whiskers
{cmdab:al:size(}{it:#}{cmd:)}{...}
{col 40}width of adjacent line; default is 67
{cmdab:cap:size:(}{it:#}{cmd:)}{...}
{col 40}height of cap on adj. line; default is 0
{cmdab:m:arker:(}{it:#}, {it:{help marker_options}}{...}
{col 40}look of {it:#}th marker and label for
{it:{help marker_label_options}}{cmd:)}{...}
{col 40} outside values
{cmd:outergap(}[{cmd:*}]{it:#}{cmd:)}{...}
{col 40}gap between edge and first box
{col 40} and between last box and edge
{cmd:boxgap(}{it:#}{cmd:)}{...}
{col 40}gap between boxes; default is 33
{hline 70}
{it:legending_options}{marker legending_options}{col 40}description
{hline 70}
{it:{help legend_option}}{...}
{col 40}control of {it:yvar} legend
{cmdab:nolab:el}{...}
{col 40}use {it:yvar} names, not labels, in legend
{cmdab:yvar:options:(}{help graph box##over_subopts:{it:over_subopts}}{cmd:)}{...}
{col 40}{it:over_subopts} for {it:yvars}; rarely specified
{cmd:showyvars}{...}
{col 40}label {it:yvars} on {it:x} axis; rarely specified
{hline 70}
{it:axis_options}{marker axis_options}{col 40}description
{hline 70}
{cmdab:yalt:ernate}{...}
{col 40}put numerical {it:y} axis on right (top)
{cmdab:xalt:ernate}{...}
{col 40}put categorical {it:x} axis on top (right)
{cmdab:yrev:erse}{...}
{col 40}reverse {it:y} axis
{it:{help axis_scale_options}}{...}
{col 40}{it:y}-axis scaling and look
{it:{help axis_label_options}}{...}
{col 40}{it:y}-axis labeling
{help axis_title_options:{bf:ytitle(...)}}{...}
{col 40}{it:y}-axis titling
{hline 70}
{it:title_and_other_options}{marker title_and_other_options}{col 40}description
{hline 70}
{help added_text_option:{bf:text(...)}}{...}
{col 40}add text on graph; {it:x} range [0,100]
{help added_line_options:{bf:yline(...)}}{...}
{col 40}add {it:y} lines to graph
{it:{help aspect_option}}{...}
{col 40}constrain aspect ratio of plot region
{it:{help std_options}}{...}
{col 40}titles, graph size, saving to disk
{help by_option:{bf:by(}{it:varlist}{bf:, ...)}}{...}
{col 40}repeat for subgroups
{hline 70}
{pstd}{marker over_subopts}
The {it:over_subopts}{hline 2}used in
{cmd:over(}{it:varname}{cmd:,} {it:over_subopts}{cmd:)}
and, on rare occasion, in
{cmd:yvaroptions(}{it:over_subopts}{cmd:)}{hline 2}are
{it:over_subopts}{col 40}description
{hline 70}
{cmdab:tot:al}{...}
{col 40}add total group
{cmdab:re:label:(}{it:#} {cmd:"}{it:text}{cmd:"} ...{cmd:)}{...}
{col 40}change axis labels
{cmdab:lab:el:(}{it:{help cat_axis_label_options}}{cmd:)}{...}
{col 40}rendition of labels
{cmdab:ax:is:(}{it:{help cat_axis_line_options}}{cmd:)}{...}
{col 40}rendition of axis line
{cmd:gap(}[{cmd:*}]{it:#}{cmd:)}{...}
{col 40}gap between boxes within {cmd:over()} category
{cmd:sort(}{it:varname}{cmd:)}{...}
{col 40}put boxes in prespecified order
{cmd:sort(}{it:#}{cmd:)}{...}
{col 40}put boxes in median order
{cmdab:des:cending}{...}
{col 40}reverse default or specified box order
{hline 70}
{pstd}
{cmd:aweight}s, {cmd:fweight}s, and {cmd:pweight}s are allowed;
see {help weight} and see note concerning weights in
{helpb collapse}.
{title:Description}
{pstd}
{cmd:graph} {cmd:box} draws vertical box plots. In a vertical
box plot, the {it:y} axis is numerical, and the {it:x} axis is categorical.
{cmd:. graph box} {it:y1 y2}{cmd:, over(}{it:cat_var}{cmd:)}
{it:y}
8 {c RT}
{c |} {c TT} o
{c |} o {c |} {c TT} {it:y1}, {it:y2} must be numeric;
6 {c RT} {c TLC}{c BT}{c TRC} {c TT} {c |} statistics are shown on
{c |} {c TT} {c |} {c |} {c TLC}{c BT}{c TRC} {c TLC}{c BT}{c TRC} the {it:y }axis
{c |} {c TLC}{c BT}{c TRC} {c |}-{c |} {c |}-{c |} {c |} {c |}
4 {c RT} {c |}-{c |} {c BLC}{c TT}{c BRC} {c BLC}{c TT}{c BRC} {c |}-{c |} {it:cat_var} may be numeric
{c |} {c BLC}{c TT}{c BRC} {c |} {c BT} {c BLC}{c TT}{c BRC} or string; it is shown
{c |} {c BT} {c BT} {c |} on categorical {it:x} axis
2 {c RT} o {c BT}
{c BLC}{hline 27} {it:x}
first second
group group
{pstd}
The encoding and the words used to describe the encoding are
o <- outside values
o
{it:adjacent line} {c -}{c -}{c TRC} {c TT} <- upper adjacent value
{c |} {c |}
{it:whiskers} {c |} {c |}
{c -}{c RT} {c TLC}{c -}{c BT}{c -}{c TRC} <- 75th percentile (upper hinge)
{c |} {c |} {c |}
{it:box} {c |} {c LT}{hline 3}{c RT} <- median
{c |} {c |} {c |}
{c -}{c RT} {c BLC}{c -}{c TT}{c -}{c BRC} <- 25th percentile (lower hinge)
{it:whiskers} {c |} {c |}
{c |} {c |}
{it:adjacent line} {c -}{c -}{c BRC} {c BT} <- lower adjacent value
o <- outside value
{pstd}
{cmd:graph} {cmd:hbox} draws horizontal box plots. In a horizontal box
plot, the numerical axis is still called the {it:y} axis, and the categorical
axis is still called the {it:x} axis, but {it:y} is presented horizontally,
and {it:x} vertically.
{cmd:. graph hbox} {it:y1 y2}{cmd:, over(}{it:cat_var}{cmd:)}
{it:x}
{c |} {c TLC}{hline 3}{c TRC}
{c |} {c LT}{hline 2}{c RT} | {c LT}{hline 2}{c RT} o
first {c |} {c BLC}{hline 3}{c BRC}
group {c |}
{c |} {c TLC}{hline 6}{c TRC}
{c |} {c LT}{hline 5}{c RT} | {c LT}{hline 5}{c RT} same conceptual layout
{c |} {c BLC}{hline 6}{c BRC} as for {cmd:graph box}:
{c |}
{c |} {it:y1}, {it:y2} appear on {it:y} axis
{c |} {c TLC}{hline 3}{c TRC}
{c |} o {c LT}{hline 2}{c RT} | {c LT}{hline 2}{c RT} {it:cat_var} appears on {it:x} axis
second {c |} {c BLC}{hline 3}{c BRC}
group {c |}
{c |} {c TLC}{hline 6}{c TRC}
{c |} {c LT}{hline 5}{c RT} | {c LT}{hline 5}{c RT}o
{c |} {c BLC}{hline 6}{c BRC}
{c |}
{c BLC}{c TT}{hline 6}{c TT}{hline 6}{c TT}{hline 6}{c TT}{hline 4} {it:y}
2 4 6 8
{title:group_options}
{phang}
{cmd:over(}{it:varname}[{cmd:,} {it:over_subopts}]{cmd:)}
specifies a categorical variable over which the {it:yvars} are to be
repeated. {it:varname} may be string or numeric. Up to two {cmd:over()}
options may be specified when multiple {it:yvars} are specified,
and up to three {cmd:over()}s may be specified when a single {it:yvar} is
specified; see {help graph box##remarks2:Examples of syntax} under
{hi:Remarks} below.
{phang}
{cmd:nofill}
specifies that missing subcategories be omitted. See the
description of the {cmd:nofill} option in {helpb graph bar}.
{phang}
{cmd:missing}
specifies that missing values of the {cmd:over()} variables be kept as
their own categories, one for {cmd:.}, another for {cmd:.a}, etc. The
default is to ignore such observations. An {cmd:over()} variable is
considered to be missing if it is numeric and contains a missing value or
if it is string and contains "".
{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()}.
{title:yvar_options}
{phang}
{cmd:ascategory}
specifies that the {it:yvars} be treated as the first {cmd:over()} group.
The important effect of this is to move the captioning of the variables
from the legend to the categorical {it:x} axis. See the description of
{cmd:ascategory} in {helpb graph bar}.
{phang}
{cmd:asyvars}
specifies that the first {cmd:over()} group be treated as {it:yvars}.
The important effect of this is to move the captioning of the first over
group from the categorical {it:x} axis to the legend. See the description
of {cmd:asyvars} in {helpb graph bar}.
{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 statistics for each box using all the data possible.
{title:boxlook_options}
{phang}
{cmd:nooutsides}
specifies that the outside values not be plotted or used in setting the
scale of the {it:y} axis.
{phang}
{cmd:box(}{it:#}{cmd:,} {it:barlook_options}{cmd:)}
specifies the look of the {it:yvar} boxes.
{cmd:box(1,} ...{cmd:)} refers to the box associated with the first
{it:yvar}, {cmd:box(2,} ...{cmd:)} refers to the box associated with the
second, and so on.
{pmore}
Note that you specify {it:barlook_options}. Those options are
borrowed from {cmd:graph} {cmd:bar} in the case of boxes.
The most useful {it:barlook_option} is
{cmd:color(}{it:colorstyle}{cmd:)}, which sets the color of the box. For
instance, you might specify {cmd:box(1, color(green))} to make the box
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}.
{phang}
{cmd:pcycle(}{it:#}{cmd:)}
specifies how many variables are to be plotted before the {help pstyle} of
the boxes for the next variable begins again at the {cmd:pstyle} of the
first variable{hline 2}{cmd:p1box} (with the boxes for the variable
following that using {cmd:p2box} and so). Put another way, {it:#}
specifies how quickly the look of boxes is recycled when more than {it:#}
variables are specified. The default {it:#} for most {help schemes}
is 15.
{phang}
{cmd:intensity(}{it:#}{cmd:)}
and
{cmd:intensity(*}{it:#}{cmd:)}
specify the intensity of the color used to fill the inside of the box.
{cmd:intensity(}{it:#}{cmd:)} specifies the intensity, and
{cmd:intensity(*}{it:#}{cmd:)} specifies the intensity relative to the
default.
{pmore}
By default, the box 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.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -