📄 graph_matrix.hlp
字号:
{it:axis_label_options} specified outside the {cmd:maxes()} option
specify options that affect just one of the axes. {it:axis_label_options}
can be repeated for each axis.
{pmore}
When you specify {it:axis_label_options} outside of {cmd:maxes()},
you must specify the axis-label suboption {cmd:axis(}{it:#}{cmd:)}.
For instance, you might type
{phang3}
{cmd:. graph mpg weight displ, yaxis(0(5)40, axis(1))}
{pmore}
The effect of that would be to label the specified values on the
first {it:y} axis (the one appearing on the far right).
The axes are numbered as follows:
{it:x} {it:x}
{cmd:axis(2)} {cmd:axis(4)}
{c TLC}{hline 7}{c TT}{hline 7}{c TT}{hline 7}{c TT}{hline 7}{c TT}{hline 7}{c TRC}
{...}
{c |} {c |} v1/v2 {c |} v1/v3 {c |} v1/v4 {c |} v1/v5 {c |} {it:y} {cmd:axis(1)}
{...}
{c LT}{hline 7}{c +}{hline 7}{c +}{hline 7}{c +}{hline 7}{c +}{hline 7}{c RT}
{...}
{it:y} {cmd:axis(2)} {c |} v2/v1 {c |} {c |} v2/v3 {c |} v2/v4 {c |} v2/v5 {c |}
{c LT}{hline 7}{c +}{hline 7}{c +}{hline 7}{c +}{hline 7}{c +}{hline 7}{c RT}
{...}
{c |} v3/v1 {c |} v3/v2 {c |} {c |} v3/v4 {c |} v3/v5 {c |} {it:y} {cmd:axis(3)}
{c LT}{hline 7}{c +}{hline 7}{c +}{hline 7}{c +}{hline 7}{c +}{hline 7}{c RT}
{...}
{it:y} {cmd:axis(4)} {c |} v4/v1 {c |} v4/v2 {c |} v4/v3 {c |} {c |} v4/v5 {c |}
{c LT}{hline 7}{c +}{hline 7}{c +}{hline 7}{c +}{hline 7}{c +}{hline 7}{c RT}
{...}
{c |} v5/v1 {c |} v5/v2 {c |} v5/v3 {c |} v5/v4 {c |} {c |} {it:y} {cmd:axis(5)}
{c BLC}{hline 7}{c BT}{hline 7}{c BT}{hline 7}{c BT}{hline 7}{c BT}{hline 7}{c BRC}
{it:x x x}
{cmd:axis(1) axis(3) axis(5)}
{pmore}
and if {cmd:half} is specified, the numbering scheme is
{c TLC}{hline 7}{c TRC}
{c |} {c |}
{c LT}{hline 7}{c +}{hline 7}{c TRC}
{it:y} {cmd:axis(2)} {c |} v2/v1 {c |} {c |}
{c LT}{hline 7}{c +}{hline 7}{c +}{hline 7}{c TRC}
{it:y} {cmd:axis(3)} {c |} v3/v1 {c |} v3/v2 {c |} {c |}
{c LT}{hline 7}{c +}{hline 7}{c +}{hline 7}{c +}{hline 7}{c TRC}
{...}
{it:y} {cmd:axis(4)} {c |} v4/v1 {c |} v4/v2 {c |} v4/v3 {c |} {c |}
{c LT}{hline 7}{c +}{hline 7}{c +}{hline 7}{c +}{hline 7}{c +}{hline 7}{c TRC}
{...}
{it:y} {cmd:axis(5)} {c |} v5/v1 {c |} v5/v2 {c |} v5/v3 {c |} v5/v4 {c |} {c |}
{...}
{c BLC}{hline 7}{c BT}{hline 7}{c BT}{hline 7}{c BT}{hline 7}{c BT}{hline 7}{c BRC}
{...}
{it:x x x x x}
{cmd:axis(1) axis(2) axis(3) axis(4) axis(5)}
{pmore}
See {it:{help axis_label_options}}; remember to specify the
{cmd:axis(}{it:#}{cmd:)} suboption, and do not specify the
{cmd:graph matrix} option {cmd:maxes()}.
{phang}
{cmd:by(}{it:varlist}{cmd:,} ...{cmd:)}
allows drawing multiple graphs for each subgroup of the data.
See {help graph matrix##remarks6:Use with by()} under {hi:Remarks} below,
and see {it:{help by_option}}.
{phang}
{it:std_options}
allow you to specify titles
(see {help graph matrix##remarks5:Adding titles} under {hi:Remarks} below,
and see {it:{help title_options}}), control the aspect ratio and
background shading (see {it:{help region_options}}), control the overall
look of the graph (see {it:{help scheme_option}}), and save the graph to
disk (see {it:{help saving_option}}).
{pmore}
See {it:{help std_options}} for an overview of the standard options.
{title:Remarks}
{pstd}
Remarks are presented under the headings
{help graph matrix##remarks1:Typical use}
{help graph matrix##remarks2:Marker symbols and the number of observations}
{help graph matrix##remarks3:Controlling the axes labeling}
{help graph matrix##remarks4:Adding grid lines}
{help graph matrix##remarks5:Adding titles}
{help graph matrix##remarks6:Use with by()}
{help graph matrix##remarks7:History}
{marker remarks1}{...}
{title:Typical use}
{pstd}
{cmd:graph} {cmd:matrix} provides an excellent alternative to
correlation matrices (see {helpb correlate}) as a quick way to examine
the relationships among variables:
{cmd:. sysuse lifeexp, clear}
{cmd:. gr matrix popgrowth-safewater}
{it:({stata "gr_example lifeexp: gr matrix popgrowth-safewater":click to run})}
{* graph grmatrix1}{...}
{pstd}
Seeing the above graph, we are tempted to transform {cmd:gnppc} into
log units:
{cmd:. generate lgnppc = ln(gnppc)}
{cmd:. gr matrix popgr lexp lgnp safe}
{it:({stata "gr_example2 matrix1":click to run})}
{* graph grmatrix2}{...}
{pstd}
Some people prefer showing just half the matrix, moving the "dependent"
variable to the end of the list:
{cmd:. gr matrix popgr lgnp safe lexp, half}
{it:({stata "gr_example2 matrix2":click to run})}
{* graph grmatrix3}{...}
{marker remarks2}{...}
{title:Marker symbols and the number of observations}
{pstd}
The {cmd:msymbol()} option{hline 2}abbreviation {cmd:ms()}{hline 2}allows us to
control the marker symbol used; see {it:{help marker_options}}.
Hollow symbols sometimes work better as the number of observations increases:
{cmd:. sysuse auto, clear}
{cmd:. gr mat mpg price weight length, ms(Oh)}
{it:({stata "gr_example auto: gr mat mpg price weight length, ms(Oh)":click to run})}
{* graph grmatrix4}{...}
{pstd}
Points work best when there is lots of data:
{cmd:. sysuse citytemp, clear}
{cmd:. gr mat heatdd-tempjuly, ms(p)}
{it:({stata "gr_example citytemp: gr mat heatdd-tempjuly, ms(p)":click to run})}
{* graph citytemp}{...}
{marker remarks3}{...}
{title:Controlling the axes labeling}
{pstd}
By default, approximately 3 values are labeled and ticked on the {it:y} and
{it:x} axes. When graphing only a few variables, increasing this often works
well:
{cmd:. sysuse citytemp, clear}
{phang2}
{cmd:. gr mat heatdd-tempjuly, ms(p) maxes(ylab(#4) xlab(#4))}
{p_end}
{it:({stata "gr_example citytemp: gr mat heatdd-tempjuly, ms(p) maxes(ylab(#4) xlab(#4))":click to run})}
{* graph citytemp2}{...}
{pstd}
Specifying {cmd:#4} does not guarantee four labels; it specifies that
approximately four labels be used; see {it:{help axis_label_options}}. Also
see {it:axis_label_options} under {hi:Options} above for instructions on
controlling the axes individually.
{marker remarks4}{...}
{title:Adding grid lines}
{pstd}
To add horizontal grid lines, specify {cmd:maxes(ylab(,grid))},
and to add vertical grid lines,
specify {cmd:maxes(xlab(,grid))}.
Below we do both and specify that four values be labeled:
{cmd:. sysuse lifeexp, clear}
{cmd:. generate lgnppc = ln(gnppc)}
{phang2}
{cmd:. gr matrix popgr lexp lgnp safe, maxes(ylab(#4, grid) xlab(#4, grid))}
{p_end}
{it:({stata "gr_example2 matrix3":click to run})}
{* graph matrix3}{...}
{marker remarks5}{...}
{title:Adding titles}
{pstd}
The standard title options may be used with {cmd:graph} {cmd:matrix}:
{cmd:. sysuse lifeexp, clear}
{cmd:. generate lgnppc = ln(gnppc)}
{cmd:. label var lgnppc "ln GNP per capita"}
{cmd:. gr matrix popgr lexp lgnp safe, maxes(ylab(#4, grid) xlab(#4, grid))}
{cmd: subtitle("Summary of 1998 life-expectancy data")}
{cmd: note("Source: The World Bank Group")}
{it:({stata "gr_example2 matrix4":click to run})}
{* graph matrix4}{...}
{marker remarks6}{...}
{title:Use with by()}
{pstd}
{cmd:graph} {cmd:matrix} may be used with {cmd:by()}:
{cmd:. sysuse auto, clear}
{cmd:. gr matrix mpg weight displ, by(foreign)}
{it:({stata "gr_example auto: gr matrix mpg weight displ, by(foreign)":click to run})}
{* graph grmatrix5}{...}
{pstd}
See {it:{help by_option}}.
{* index histories}{...}
{* index Hartigan 1975}{...}
{* index Tukey and Tukey 1981}{...}
{* index Chambers et al. 1983}{...}
{* index Becker and Chambers 1984}{...}
{marker remarks7}{...}
{title:History}
{pstd}
The origin of the scatterplot matrix is unknown, although early written
discussions may be found in Hartigan (1975), Tukey and Tukey (1981), and
Chambers et al. (1983). The scatterplot matrix has also been called the
{it:draftman's display} and {it:pairwise scatterplot}.
Regardless of the name used, we believe the first "canned" implementation
was by Becker and Chambers in a system called S{hline 2}see
Becker and Chambers (1984){hline 2}although S predates 1984. We also believe
that Stata provided the second implementation, in 1985.
{title:Also see}
{psee}
Manual: {bf:[G] graph matrix}
{psee}
Online:
{helpb graph};
{helpb scatter}
{p_end}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -