📄 advanced_options.hlp
字号:
{smcl}
{* 07mar2005}{...}
{cmd:help advanced_options}
{hline}
{* index plottypes, derived}{...}
{* index plottypes, base}{...}
{* index derived plottypes}{...}
{* index base plottypes}{...}
{* index yvarlabel() tt option}{...}
{* index xvarlabel() tt option}{...}
{* index yvarformat() tt option}{...}
{* index xvarformat() tt option}{...}
{* index recast() tt option}{...}
{title:Title}
{p2colset 5 29 31 2}{...}
{p2col :{hi:[G] {it:advanced_options}} {hline 2}}Rarely specified options for use with graph twoway{p_end}
{p2colreset}{...}
{title:Syntax}
{it:title_options}{col 41}description
{hline 69}
{col 9}{...}
{cmdab:pcyc:le:(}{it:#}{cmd:)}{...}
{col 41}plots before {help pstyle:pstyles} recycle
{col 9}{...}
{cmdab:yvarl:abel:(}{it:quoted_strings}{cmd:)}{...}
{col 41}respecify {it:y}-variable labels
{col 9}{...}
{cmdab:xvarl:abel:(}{it:quoted_string}{cmd:)}{...}
{col 41}respecify {it:x}-variable label
{col 9}{...}
{cmdab:yvarf:ormat:(}{help format:{bf:%}{it:fmt}} [...]{cmd:)}{...}
{col 41}respecify {it:y}-variable formats
{col 9}{...}
{cmdab:xvarf:ormat:(}{help format:{bf:%}{it:fmt}}{cmd:)}{...}
{col 41}respecify {it:x}-variable format
{col 9}{...}
{cmd:recast(}{it:newplottype}{cmd:)}{...}
{col 41}treat plot as {it:newplottype}
{hline 69}
{pin}
The above options are {it:rightmost}; see {help repeated options}.
{pstd}
where {it:quoted_string} is one quoted string and {it:quoted_strings} are
one or more quoted strings, such as
{cmd:"}{it:plot 1 label}{cmd:"}
{cmd:"}{it:plot 1 label}{cmd:"} {cmd:"}{it:plot 2 label}{cmd:"}
{it:newplottype}{col 41}description
{hline 69}
{cmdab:sc:atter}{...}
{col 41}treat as {cmd:graph} {cmd:twoway} {cmd:scatter}
{cmdab:li:ne}{...}
{col 41}treat as {cmd:graph} {cmd:twoway} {cmd:line}
{cmdab:con:nected}{...}
{col 41}treat as {cmd:graph} {cmd:twoway} {cmd:connected}
{cmd:bar}{...}
{col 41}treat as {cmd:graph} {cmd:twoway} {cmd:bar}
{cmd:spike}{...}
{col 41}treat as {cmd:graph} {cmd:twoway} {cmd:spike}
{cmd:dropline}{...}
{col 41}treat as {cmd:graph} {cmd:twoway} {cmd:dropline}
{cmd:dot}{...}
{col 41}treat as {cmd:graph} {cmd:twoway} {cmd:dot}
{cmd:rarea}{...}
{col 41}treat as {cmd:graph} {cmd:twoway} {cmd:rarea}
{cmd:rbar}{...}
{col 41}treat as {cmd:graph} {cmd:twoway} {cmd:rbar}
{cmd:rspike}{...}
{col 41}treat as {cmd:graph} {cmd:twoway} {cmd:rspike}
{cmd:rcap}{...}
{col 41}treat as {cmd:graph} {cmd:twoway} {cmd:rcap}
{cmd:rcapsym}{...}
{col 41}treat as {cmd:graph} {cmd:twoway} {cmd:rcapsym}
{cmd:rline}{...}
{col 41}treat as {cmd:graph} {cmd:twoway} {cmd:rline}
{cmd:rconnected}{...}
{col 41}treat as {cmd:graph} {cmd:twoway} {cmd:rconnected}
{cmd:rscatter}{...}
{col 41}treat as {cmd:graph} {cmd:twoway} {cmd:rscatter}
{hline 69}
{pin}
Note: {it:newplottypes} in the second group ({cmd:rarea} though
{cmd:rscatter}) may be recast only among themselves.
{title:Description}
{pstd}
The {it:advanced_options} are not so much advanced as they are difficult to
explain and are rarely used. They are also invaluable when you need them.
{title:Options}
{phang}
{cmd:pcycle(}{it:#}{cmd:)}
specifies how many plots are drawn before the {help pstyle} of the next plot
begins again at {cmd:p1}, with the plot after the next plot using
{cmd:p2}, and so on. The default {it:#} for most {help schemes} is 15.
{phang}
{cmd:yvarlabel(}{it:quoted_strings}{cmd:)}
and
{cmd:xvarlabel(}{it:quoted_string}{cmd:)}
specify strings that are to be treated as if they were the variable
labels of the first, second, ..., {it:y} variables and of the {it:x}
variable.
{phang}
{cmd:yvarformat(%}{it:fmt}{cmd:)}
and
{cmd:xvarformat(%}{it:fmt}{cmd:)}
specify display formats that are to be treated as if they were the
display formats of the first, second, ..., {it:y} variables and of the
{it:x} variable.
{phang}
{cmd:recast(}{it:newplottype}{cmd:)}
specifies the new plottype to which the original
{cmd:graph} {cmd:twoway} {it:plottype} command is to be recast.
{title:Remarks}
{pstd}
Remarks are presented under the headings
{help advanced_options##remarks1:Use of yvarlabel() and xvarlabel()}
{help advanced_options##remarks2:Use of yvarformat() and xvarformat()}
{help advanced_options##remarks3:Use of recast()}
{marker remarks1}{...}
{title:Use of yvarlabel() and xvarlabel()}
{pstd}
When you type, for instance,
{cmd:. scatter mpg weight}
{pstd}
the axes are titled using the variable labels of mpg and weight or, if the
variables have no variable labels, using the names of the variables
themselves. Options {cmd:yvarlabel()} and {cmd:xvarlabel()} allow you to
specify strings that will be used in preference to both the variable label
and the name.
{phang2}
{cmd:. scatter mpg weight, yvarl("Miles per gallon")}
{pstd}
would label the {it:y} axis "Miles per gallon" (omitting the quotes),
regardless of how variable mpg was labeled. Similarly,
{phang2}
{cmd:. scatter mpg weight, xvarl("Weight in pounds")}
{pstd}
would label the {it:x} axis "Weight in pounds", regardless of how
variable weight was labeled.
{pstd}
Obviously, you could specify both options.
{pstd}
In neither case will the actual variable label be changed. Options
{cmd:yvarlabel()} and {cmd:xvarlabel()} treat the specified strings as if
they were the variable labels. {cmd:yvarlabel()} and {cmd:xvarlabel()} are
quite literal in this treatment. If you specified {cmd:xvarlabel("")},
for instance, the variable label would be treated as if it were nonexistent,
and thus the variable name would be used to title the {it:x} axis.
{pstd}
What makes these two options "advanced" is not only that they affect the way
axes are titled, but also that they substitute the specified strings for the
variable labels wherever the variable label might be used. Variable labels
are also used, for instance, in the construction of legends (see
{it:{help legend_option}}).
{marker remarks2}{...}
{title:Use of yvarformat() and xvarformat()}
{pstd}
Options {cmd:yvarformat()} and {cmd:xvarformat()} work much like
{cmd:yvarlabel()} and {cmd:xvarlabel()}, except that, rather than overriding
the variable labels, they override the variable formats.
If you type
{phang2}
{cmd:. scatter mpg weight, yvarformat(%9.2f)}
{pstd}
the values on the {it:y} axis will be labeled 10.00, 20.00, 30.00, and 40.00
rather than 10, 20, 30, and 40.
{marker remarks3}{...}
{title:Use of recast()}
{pstd}
{cmd:scatter}, {cmd:line}, {cmd:histogram}, ...{hline 2}the word that appears
directly after {cmd:graph} {cmd:twoway}{hline 2}is called a {it:plottype}.
Plottypes come in two flavors: {it:base} {it:plottypes} and
{it:derived} {it:plottypes}.
{pstd}
Base plottypes plot the data as given according to some style.
{cmd:scatter} and {cmd:line} are examples of base plottypes.
{pstd}
Derived plottypes do not plot the data as given, but instead derive something
from the data and then plot that according to one of the base plottypes.
{cmd:histogram} is an example of a derived plottype. It derives from the data
the values for the frequencies at certain {it:x} ranges, and then it plots
that derived data using the base plottype {cmd:graph} {cmd:twoway} {cmd:bar}.
{cmd:lfit} is another example of a derived plottype. It takes the data, fits
a linear regression, and then passes that result along to {cmd:graph}
{cmd:twoway} {cmd:line}.
{pstd}
{cmd:recast()} is useful when using derived plottypes. It specifies that the
data are to be derived just as they would be ordinarily, but rather than
passing the derived data to the default base plottype for plotting, they are
passed to the specified base plottype.
{pstd}
For instance, if we typed
{phang2}
{cmd:. twoway lfit mpg weight, pred(resid)}
{pstd}
we would obtain a graph of the residuals as a line plot because the
{cmd:lfit} plottype produces line plots. If we typed
{phang2}
{cmd:. twoway lfit mpg weight, pred(resid) recast(scatter)}
{pstd}
we would obtain a scatterplot of the residuals. {cmd:graph} {cmd:twoway}
{cmd:lfit} would use {cmd:graph} {cmd:twoway} {cmd:scatter} rather than
{cmd:graph} {cmd:twoway} {cmd:line} to plot the data it derives.
{pstd}
{cmd:recast(}{it:newplottype}{cmd:)} may be used with both derived and base
plottypes, although it is most useful when combined with derived plots.
{pin}
{hi:Technical note:}{break}
The syntax diagram shown for {cmd:scatter} in {helpb scatter}, although
extensive, is incomplete, and so are all the other plottype
syntax diagrams shown in this manual.
{pin}
Consider what would happen if you specified
{cmd:. scatter} ...{cmd:,} ... {cmd:recast(bar)}
{pin}
You would be specifying that {cmd:scatter} be treated as a {cmd:bar}.
Results would be exactly the same as if you typed
{cmd:. bar} ...{cmd:,} ...
{pin}
but let's ignore that and pretend that you typed the {cmd:recast()} version.
What if you wanted to specify the look of the bars? You could type
{pin2}
{cmd:. scatter} ...{cmd:,} ... {it:bar_options} {cmd:recast(bar)}
{pin}
That is, {cmd:scatter} allows {it:bar_options}, even though they do not
appear in {cmd:scatter}'s syntax diagram. Similarly, {cmd:graph}
{cmd:twoway} {cmd:bar} allows all of {cmd:scatter}'s options, even though
they do not appear in {cmd:bar}'s syntax diagram, because you might type
{pin2}
{cmd:. bar} ...{cmd:,} ... {it:scatter_options} {cmd:recast(scatter)}
{pin}
The same is true for all other pairs of base plottypes, with the result
that all base plottypes allow all base plottype options. The emphasis
here is on base: the derived plottypes do not allow this sharing.
{pin}
If you use a base plottype without {cmd:recast()} and if you specify
irrelevant options from other base types, that is not an error, but
the irrelevant options
are
ignored. In the syntax diagrams for the base plottypes, we have listed only
the options that matter under the assumption that you do not specify
{cmd:recast}.
{p_end}
{right:{c TLC}{ c TRC}}
{right:{c BLC}{ c BRC}}
{title:Also see}
{psee}
Manual: {bf:[G] {it:advanced_options}}
{psee}
Online: {helpb twoway}
{p_end}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -