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

📄 graph_twoway.hlp

📁 是一个经济学管理应用软件 很难找的 但是经济学学生又必须用到
💻 HLP
📖 第 1 页 / 共 2 页
字号:
{smcl}
{* *! version 1.0.0  24may2005}{...}
{cmd:help twoway}{right:dialogs:  {dialog twoway_overlay:overlaid twoway}{space 5}}
{right:{dialog twoway_simple:single twoway}{space 7}}
{right:{dialog etwoway_overlay:easy overlaid twoway}}
{hline}

{title:Title}

{p2colset 5 25 27 2}{...}
{p2col :{hi:[G] graph twoway} {hline 2}}Twoway graphs{p_end}
{p2colreset}{...}


{title:Syntax}

{p 8 23 2}
[{cmdab:gr:aph}]
{cmdab:tw:oway}
{it:plot}
{ifin}
[{cmd:,}
{it:{help twoway_options}}]

{pstd}
where the syntax of {it:plot} is

{pin}
[{cmd:(}]
{it:plottype} {it:varlist} ...{cmd:,} {it:options}
[{cmd:)}] [{cmd:||}]

{p2colset 9 24 26 2}{...}
{p2col :{it:plottype}}description{p_end}
{p2line}
{p2col :{helpb scatter}}scatterplot{p_end}
{p2col :{helpb line}}line plot{p_end}
{p2col :{helpb twoway_connected:connected}}connected-line plot{p_end}
{p2col :{helpb twoway_scatteri:scatteri}}{cmd:scatter} with immediate arguments{p_end}

{marker barplots}
{p2col :{helpb twoway_area:area}}line plot with shading{p_end}
{p2col :{helpb twoway_bar:bar}}bar plot{p_end}
{p2col :{helpb twoway_spike:spike}}spike plot{p_end}
{p2col :{helpb twoway_dropline:dropline}}dropline plot{p_end}
{p2col :{helpb twoway_dot:dot}}dot plot{p_end}

{marker rangeplots}
{p2col :{helpb twoway_rarea:rarea}}range plot with area shading{p_end}
{p2col :{helpb twoway_rbar:rbar}}range plot with bars{p_end}
{p2col :{helpb twoway_rspike:rspike}}range plot with spikes{p_end}
{p2col :{helpb twoway_rcap:rcap}}range plot with capped spikes{p_end}
{p2col :{helpb twoway_rcapsym:rcapsym}}range plot with spikes capped with symbols{p_end}
{p2col :{helpb twoway_rscatter:rscatter}}range plot with markers{p_end}
{p2col :{helpb twoway_rline:rline}}range plot with lines{p_end}
{p2col :{helpb twoway_rconnected:rconnected}}range plot with lines and markers{p_end}

{marker pcplots}
{p2col :{helpb twoway_pcspike:pcspike}}paired-coordinate plot with spikes{p_end}
{p2col :{helpb twoway_pccapsym:pccapsym}}paired-coordinate plot 
	with spikes capped with symbols{p_end}
{p2col :{helpb twoway_pcarrow:pcarrow}}paired-coordinate plot with arrows{p_end}
{p2col :{helpb twoway_pcbarrow:pcbarrow}}paired-coordinate plot with arrows
	having two heads{p_end}
{p2col :{helpb twoway_pcscatter:pcscatter}}paired-coordinate plot 
	with markers{p_end}
{p2col :{helpb twoway_pci:pci}}{cmd:pcispike} with immediate arguments{p_end}
{p2col :{helpb twoway_pcarrowi:pcarrowi}}{cmd:pcarrow} with immediate arguments{p_end}

{p2col :{helpb tsline}}time-series plot{p_end}
{p2col :{helpb tsrline}}time-series range plot{p_end}

{p2col :{helpb twoway_mband:mband}}median-band line plot{p_end}
{p2col :{helpb twoway_mspline:mspline}}spline line plot{p_end}
{p2col :{helpb twoway_lowess:lowess}}LOWESS line plot{p_end}
{p2col :{helpb twoway_lfit:lfit}}linear prediction plot{p_end}
{p2col :{helpb twoway_qfit:qfit}}quadratic prediction plot{p_end}
{p2col :{helpb twoway_fpfit:fpfit}}fractional polynomial plot{p_end}
{p2col :{helpb twoway_lfitci:lfitci}}linear prediction plot with CIs{p_end}
{p2col :{helpb twoway_qfitci:qfitci}}quadratic prediction plot with CIs{p_end}
{p2col :{helpb twoway_fpfitci:fpfitci}}fractional polynomial plot with CIs{p_end}

{p2col :{helpb twoway_function:function}}line plot of function{p_end}
{p2col :{helpb twoway_histogram:histogram}}histogram plot{p_end}
{p2col :{helpb twoway_kdensity:kdensity}}kernel density plot{p_end}
{p2line}
{p2colreset}{...}

{pstd}
Note that the leading {cmd:graph} is optional.
If the first (or only) {it:plot} is {cmd:scatter}, you may omit
{cmd:twoway} as well, and then the syntax is

{p 8 20 2}
{cmdab:sc:atter} ... [{cmd:,} {it:scatter_options}]
[ {cmd:||}
{it:plot} [{it:plot} [...]]]

{pstd}
and the same applies to {cmd:line}.  The other
{it:plottypes} must be preceded by {cmd:twoway}.

{pstd}
Regardless of how the command is specified,
{it:twoway_options}
may be specified among the
{it:scatter_options}, {it:line_options}, etc., and they will be treated just
as if they were specified among the {it:twoway_options} of the
{cmd:graph} {cmd:twoway} command.


{title:Description}

{pstd}
{cmd:twoway} is a family of plots, all of which fit on numeric {it:y} and
{it:x} scales.


{title:Remarks}

{pstd}
Remarks are presented under the headings

	{help graph twoway##remarks1:Definition}
	{help graph twoway##remarks2:Syntax}
	{help graph twoway##remarks3:Multiple if and in restrictions}
	{help graph twoway##remarks4:twoway and plot options}


{marker remarks1}{...}
{title:Definition}

{pstd}
Twoway graphs show the relationship between numeric data.
Say that we have data on life expectancy in the U.S. between 1910 and 1930:

	{cmd}. sysuse uslifeexp2, clear

	. list in 1/8
	{txt}
	     {c TLC}{hline 6}{c -}{hline 6}{c TRC}
	     {c |} {res}year     le {txt}{c |}
	     {c LT}{hline 6}{c -}{hline 6}{c RT}
	  1. {c |} {res}1900   47.3 {txt}{c |}
	  2. {c |} {res}1901   49.1 {txt}{c |}
	  3. {c |} {res}1902   51.5 {txt}{c |}
	  4. {c |} {res}1903   50.5 {txt}{c |}
	  5. {c |} {res}1904   47.6 {txt}{c |}
	     {c LT}{hline 6}{c -}{hline 6}{c RT}
	  6. {c |} {res}1905   48.7 {txt}{c |}
	  7. {c |} {res}1906   48.7 {txt}{c |}
	  8. {c |} {res}1907   47.6 {txt}{c |}
	     {c BLC}{hline 6}{c -}{hline 6}{c BRC}{txt}


{pstd}
We could graph these data as a twoway scatterplot,

{phang2}{cmd:. twoway scatter le year}{p_end}
	  {it:({stata "gr_example uslifeexp2: twoway scatter le year":click to run})}
{* graph tw1}{...}

{pstd}
or we could graph these data as a twoway line plot,

{phang2}{cmd:. twoway line le year}{p_end}
	  {it:({stata "gr_example uslifeexp2: twoway line le year":click to run})}
{* graph tw2}{...}

{pstd}
or we could graph these data as a twoway connected plot, marking both the
points and connecting them with straight lines,

{phang2}{cmd:. twoway connected le year}{p_end}
	  {it:({stata "gr_example uslifeexp2: twoway connected  le year":click to run})}
{* graph tw3}{...}

{pstd}
or we could graph these data as a scatterplot and put on top of that the
prediction from a linear regression of {cmd:le} on {cmd:year},

{phang2}{cmd:. twoway (scatter le year) (lfit le year)}{p_end}
	  {it:({stata "gr_example uslifeexp2: twoway (scatter le year) (lfit le year)":click to run})}
{* graph tw4}{...}

{pstd}
or we could graph these data in many other ways.

{pstd}
What is important is that these are all examples of twoway graphs.
What distinguishes a twoway graph is that it fits onto numeric {it:y} and
{it:x} axes.

{pstd}
Each of what we produced above is called a {it:graph}.  What appeared in
the graphs are called {it:plots}.  In the first graph, the plottype was a
scatter; in the second, the plottype was a line; in the third, the plottype was
connected; and in the fourth, there were two plots:  a scatter combined with a
line plot of a linear fit.

{pstd}
{cmd:twoway} provides many different plottypes.  Some, such
as {cmd:scatter} and {cmd:line}, simply render
the data in different ways.  Others, such as {cmd:lfit}, transform the data
and render that.  And still others, such as {cmd:function},
actually make up data to be rendered.  This last class makes it easy
to overlay {it:y}={it:x} lines or {it:y=f(x)} functions on
your graphs.

{pstd}
By the way, in case you are wondering, there are no errors in the above data.
In 1918, there was an outbreak of influenza known as the 1918 Influenza
Pandemic, which in the U.S., was the worst epidemic ever known and which killed
more citizens than all combat deaths of the 20th century.


{marker remarks2}{...}
{title:Syntax}

{pstd}
If we want to graph y1 versus x and y2 versus x, the formal way to type this is

⌨️ 快捷键说明

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