📄 twoway_rarea.hlp
字号:
{smcl}
{* 08apr2005}{...}
{cmd:help twoway rarea} {right:dialogs: {dialog twoway_overlay:overlaid twoway}{space 0}}
{right:{dialog twoway_simple:single twoway}{space 2}}
{hline}
{title:Title}
{p2colset 5 31 33 2}{...}
{p2col :{hi:[G] graph twoway rarea} {hline 2}}Range plot with area shading{p_end}
{p2colreset}{...}
{title:Syntax}
{p 8 60 2}
{cmdab:tw:oway}
{cmd:rarea}
{it:y1var} {it:y2var} {it:xvar}
{ifin}
[{cmd:,}
{it:options}]
{p2colset 9 30 32 2}{...}
{it:options}{col 30}description
{p2line}
{cmdab:vert:ical}{...}
{col 30}vertical area plot; the default
{cmdab:hor:izontal}{...}
{col 30}horizontal area plot
{cmd:sort}{...}
{col 30}recommended
INCLUDE help gr_areaopt
INCLUDE help gr_axlnk
INCLUDE help gr_twopt
{p2line}
{pin}
All explicit options are {it:unique}; see {help repeated options}.
{title:Description}
{pstd}
A range plot has two {it:y} variables, such as high and low daily stock prices
or upper and lower 95% confidence limits.
{pstd}
{cmd:twoway} {cmd:rarea} plots range as a shaded area.
{pstd}
Also see {helpb twoway area} for area plots filled to the axis.
{title:Options}
{phang}
{cmd:vertical}
and
{cmd:horizontal}
specify whether the high and low {it:y} values are to be presented
vertically (the default) or horizontally.
{pmore}
In the default {cmd:vertical} case, {it:y1var} and {it:y2var} record
the minimum and maximum (or maximum and minimum) {it:y} values to be
graphed against each {it:xvar} value.
{pmore}
If {cmd:horizontal} is specified, the values recorded in {it:y1var} and
{it:y2var} are plotted in the {it:x} direction and {it:xvar} is treated
as the {it:y} value.
{phang}
{cmd:sort}
specifies that the data be sorted by {it:xvar} before plotting.
{phang}
{it:area_options}
set the look of the shaded areas. The most important of these options is
{cmd:color(}{it:colorstyle}{cmd:)}, which specifies the color of both
the area and its outline; see {it:{help colorstyle}} for a list of color
choices. See {it:{help area_options}} for information on the other
{it:area_options}.
INCLUDE help gr_axlnkf
INCLUDE help gr_twoptf
{title:Remarks}
{pstd}
Remarks are presented under the headings
{help twoway_rarea##remarks1:Typical use}
{help twoway_rarea##remarks2:Advanced use}
{help twoway_rarea##remarks3:Cautions}
{marker remarks1}{...}
{title:Typical use}
{pstd}
We have daily data recording the values for the S&P 500 in 2001:
{cmd:. sysuse sp500, clear}
{cmd:. list date high low close in 1/5}
{txt}
{c TLC}{hline 11}{c -}{hline 9}{c -}{hline 9}{c -}{hline 9}{c TRC}
{c |} {res} date high low close {txt}{c |}
{c LT}{hline 11}{c -}{hline 9}{c -}{hline 9}{c -}{hline 9}{c RT}
1. {c |} {res}02jan2001 1320.28 1276.05 1283.27 {txt}{c |}
2. {c |} {res}03jan2001 1347.76 1274.62 1347.56 {txt}{c |}
3. {c |} {res}04jan2001 1350.24 1329.14 1333.34 {txt}{c |}
4. {c |} {res}05jan2001 1334.77 1294.95 1298.35 {txt}{c |}
5. {c |} {res}08jan2001 1298.35 1276.29 1295.86 {txt}{c |}
{c BLC}{hline 11}{c -}{hline 9}{c -}{hline 9}{c -}{hline 9}{c BRC}{txt}
{pstd}
We will use the first 57 observations from these data:
{cmd:. twoway rarea high low date in 1/57}
{it:({stata "gr_example sp500: twoway rarea high low date in 1/57":click to run})}
{* graph gtrarea1}{...}
{marker remarks2}{...}
{title:Advanced use}
{pstd}
{cmd:rarea}
works particularly well when the upper and lower limits are smooth functions
and when the area is merely shaded rather than given an eye-catching color:
{cmd}. sysuse auto, clear
. quietly regress mpg weight
. predict hat
. predict s, stdf
. gen low = hat - 1.96*s
. gen hi = hat + 1.96*s
. twoway
rarea low hi weight, sort color(gs14) ||
scatter mpg weight{txt}
{it:({stata "gr_example2 tworarea":click to run})}
{* graph tworarea}{...}
{pstd}
Notice the use of option {cmd:color()} to change the color
of the shaded area. Also note that we graphed the shaded area first
and then the scatter. Typing
{cmd:. twoway scatter} ... {cmd:|| rarea} ...
{pstd}
would not have produced the desired result because the shaded area would
have covered up the scatterplot.
{pstd}
Also see {helpb twoway lfitci}.
{marker remarks3}{...}
{title:Cautions}
{pstd}
Be sure that the data are in the order of {it:xvar}, or specify {cmd:rarea}'s
{cmd:sort} option. If you do neither, you will get something that looks like
modern art; see {hi:Cautions} in {helpb twoway area} for an example.
{title:Also see}
{psee}
Manual: {bf:[G] graph twoway rarea}
{psee}
Online:
{helpb twoway area};
{helpb twoway rbar},
{helpb twoway rspike},
{helpb twoway rcap},
{helpb twoway rcapsym},
{helpb twoway rline},
{helpb twoway rconnected},
{helpb twoway rscatter}
{p_end}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -