📄 graph_dot.hlp
字号:
{it:axis_scale_options}
specify how the numerical {it:y} axis is scaled and how it looks; see
{it:{help axis_scale_options}}. There you will also see
option {cmd:xscale()} in addition to {cmd:yscale()}.
Ignore {cmd:xscale()}, which is irrelevant in the case of dot plots.
{phang}
{it:axis_label_options}
specify how the numerical {it:y} axis is to be labeled.
The {it:axis_label_options} also allow you to add and suppress
grid lines;
see {it:{help axis_label_options}}.
There you will see that, in addition to options
{cmd:ylabel()}, {cmd:ytick()}, {cmd:ymlabel()}, and {cmd:ymtick()},
options {cmd:xlabel()}, ..., {cmd:xmtick()} are allowed. Ignore the
{cmd:x*()} options, which are irrelevant in the case of dot charts.
{phang}
{cmd:ytitle()}
overrides the default title for the numerical {it:y} axis; see
{it:{help axis_title_options}}. There you will also find option
{cmd:xtitle()} documented, which is irrelevant in the case of dot charts.
{title:title_and_other_options}
{phang}
{cmd:text()}
adds text to a specified location on the graph; see
{it:{help added_text_option}}. The basic syntax of {cmd:text()} is
{phang3}
{cmd:text(}{it:#_y} {it:#_x} {cmd:"}{it:text}{cmd:")}
{pmore}
{cmd:text()} is documented in terms of twoway graphs. When used with
dot charts, the "numeric" {it:x} axis is scaled to run from 0 to 100.
{phang}
{cmd:yline()}
adds vertical lines at specified
{it:y} values; see {it:{help added_line_options}}. The {cmd:xline()}
option, also documented there, is irrelevant in the case of dot charts.
If your interest is in adding grid lines, see
{it:{help axis_label_options}}.
{phang}
{it:aspect_option}
allows you to control the relationship between the height and width of
a graph's plot region; see {it:{help aspect_option}}.
{phang}
{it:std_options}
allow you to add titles, control the graph size, save the graph on
disk, and much more; see {it:{help std_options}}.
{phang}
{cmd:by(}{it:varlist}{cmd:, ...)}
draws separate plots within a single graph; see {it:{help by_option}}.
{title:Suboptions for use with over() and yvaroptions()}
{phang}
{cmd:relabel(}{it:#} {cmd:"}{it:text}{cmd:"} ...{cmd:)}
specifies text to override the default category labeling.
See the description of the {cmd:relabel()} option in
{helpb graph bar} for more information about this very useful option.
{phang}
{cmd:label(}{it:cat_axis_label_options}{cmd:)}
determines other aspects of the look of the category labels on the {it:x}
axis. With the exception of {cmd:label(labcolor())} and
{cmd:label(labsize())}, these options are seldom specified; see
{it:{help cat_axis_label_options}}.
{phang}
{cmd:axis(}{it:cat_axis_line_options}{cmd:)}
specifies how the axis line is rendered. This is a rarely specified
option. See {it:{help cat_axis_line_options}}.
{phang}
{cmd:gap(}{it:#}{cmd:)} and
{cmd:gap(*}{it:#}{cmd:)}
specify the gap between the lines in this {cmd:over()} group.
{cmd:gap(}{it:#}{cmd:)} is specified in percentage-of-bar-width units.
Just remember that {cmd:gap(50)} is a considerable, but not excessive width.
{cmd:gap(*}{it:#}{cmd:)} allows modifying the default gap.
{cmd:gap(*1.2)} would increase the gap by 20%, and {cmd:gap(*.8)} would
decrease the gap by 20%.
{phang}
{cmd:sort(}{it:varname}{cmd:)},
{cmd:sort(}{it:#}{cmd:)}, and
{cmd:sort((}{it:stat}{cmd:)} {it:varname}{cmd:)}
control how the lines are ordered.
See {hi:How bars are ordered} and {hi:Reordering the bars} in
{helpb graph bar}.
{pmore}
{cmd:sort(}{it:varname}{cmd:)} puts the lines in the order of {it:varname}.
{pmore}
{cmd:sort(}{it:#}{cmd:)} puts the markers in distance order.
{it:#} refers to the {it:yvar} number on which the ordering should be
performed.
{pmore}
{cmd:sort((}{it:stat}{cmd:)} {it:varname}{cmd:)}
puts the lines in an order based on a calculated statistic.
{phang}
{cmd:descending}
specifies that the order of the lines{hline 2}default or as specified
by {cmd:sort()}{hline 2}be reversed.
{title:Remarks}
{pstd}
Remarks are presented under the headings
{help graph dot##remarks1:Relationship between dot plots and horizontal bar charts}
{help graph dot##remarks2:Examples}
{help graph dot##remarks3:Appendix: Examples of syntax}
{marker remarks1}{...}
{title:Relationship between dot plots and horizontal bar charts}
{pstd}
Despite appearances, {cmd:graph} {cmd:hbar} and {cmd:graph} {cmd:dot} are in
fact the same command, meaning that concepts and options are the same:
{cmd:. graph hbar y, over(group)}
{c LT}{hline 3}{c TRC}
group 1 {c |} {c |}
{c LT}{hline 3}{c BRC}
{c |}
{c LT}{hline 8}{c TRC}
group 2 {c |} {c |}
{c LT}{hline 8}{c BRC}
{c |}
{c LT}{hline 14}{c TRC}
group 3 {c |} {c |}
{c LT}{hline 14}{c BRC}
{c |}
{c BLC}{c TT}{hline 4}{c TT}{hline 4}{c TT}{hline 4}{c TT}
{cmd:. graph dot y, over(group)}
group 1 {c |}...o............
group 2 {c |}........o.......
group 3 {c |}..............o.
{c BLC}{c TT}{hline 4}{c TT}{hline 4}{c TT}{hline 4}{c TT}
{pstd}
There is only one substantive difference between the two commands: Given
multiple {it:yvars}, {cmd:graph} {cmd:hbar} draws multiple bars:
{cmd:. graph hbar y1 y2, over(group)}
{c LT}{c -}{c TRC}
{c |} {c |}
group 1 {c LT}{c -}{c BT}{c -}{c TRC}
{c |} {c |}
{c LT}{hline 3}{c BRC}
{c |}
{c LT}{hline 3}{c TRC}
{c |} {c |}
group 2 {c LT}{hline 3}{c BT}{hline 4}{c TRC}
{c |} {c |}
{c LT}{hline 8}{c BRC}
{c |}
{c LT}{hline 5}{c TRC}
{c |} {c |}
group 3 {c LT}{hline 5}{c BT}{hline 8}{c TRC}
{c |} {c |}
{c LT}{hline 14}{c BRC}
{c |}
{c BLC}{c TT}{hline 4}{c TT}{hline 4}{c TT}{hline 4}{c TT}
{pstd}
{cmd:graph} {cmd:dot} draws multiple markers on single lines:
{cmd:. graph dot y1 y2, over(group)}
group 1 {c |}.x.o............
group 2 {c |}...x....o.......
group 3 {c |}.....x........o.
{c BLC}{c TT}{hline 4}{c TT}{hline 4}{c TT}{hline 4}{c TT}
{pstd}
The way around this problem (if it is a problem) is to specify option
{cmd:ascategory} or to specify option {cmd:linegap(}{it:#}{cmd:)}. Specifying
{cmd:ascategory} is usually best.
{pstd}
Read about {cmd:graph} {cmd:hbar} in {helpb graph bar}.
{marker remarks2}{...}
{title:Examples}
{pstd}
Since {cmd:graph} {cmd:dot} and {cmd:graph} {cmd:hbar} are so related,
the following examples should require little by way of explanation:
{cmd}. sysuse nlsw88, clear
. graph dot wage, over(occ, sort(1))
ytitle("")
title("Average hourly wage, 1988, women aged 34-46", span)
subtitle(" ")
note("Source: 1988 data from NLS, U.S. Dept. of Labor,
Bureau of Labor Statistics", span){txt}
{it:({stata gr_example2 grdottall:click to run})}
{* graph grdottall}{...}
{cmd}. graph dot (p10) p10=wage (p90) p90=wage,
over(occ, sort(2))
legend(label(1 "10th percentile") label(2 "90th percentile"))
title("10th and 90th percentiles of hourly wage", span)
subtitle("Women aged 34-46, 1988" " ", span)
note("Source: 1988 data from NLS, U.S. Dept. of Labor,
Bureau of Labor Statistics", span){txt}
{it:({stata gr_example2 grdottall2:click to run})}
{* graph grdottall2}{...}
{cmd}. graph dot (mean) wage,
over(occ, sort(1))
by(collgrad,
title("Average hourly wage, 1988, women aged 34-46", span)
subtitle(" ")
note("Source: 1988 data from NLS, U.S. Dept. of Labor,
Bureau of Labor Statistics", span)
){txt}
{it:({stata gr_example2 grdotby:click to run})}
{* graph grdottall2}{...}
{marker remarks3}{...}
{title:Appendix: Examples of syntax}
{pstd}
Let us consider some {cmd:graph} {cmd:dot} commands and what they do:
{p 4 8 8}
{cmd:graph dot revenue}{break}
One line showing average revenue.
{p 4 8 8}
{cmd:graph dot revenue profit}{break}
One line with two markers, one showing average revenue and the other
average profit.
{p 4 8 8}
{cmd:graph dot revenue, over(division)}{break}
{it:#_of_divisions} lines, each with one marker showing average revenue
for each division.
{p 4 8 8}
{cmd:graph dot revenue profit, over(division)}{break}
{it:#_of_divisions} lines, each with two markers, one
showing average revenue and the other average
profit for each division.
{p 4 8 8}
{cmd:graph dot revenue, over(division) over(year)}{break}
{it:#_of_divisions}*{it:#_of_years} lines, each with one marker showing
average revenue for each division, repeated for each of the years. The
grouping would look like this (assuming 3 divisions and 2 years):
division 1 {c |}....o...............
year 1 division 2 {c |}..........o.........
division 3 {c |}..............o.....
{c |}
division 1 {c |}.o..................
year 2 division 2 {c |}.......o............
division 3 {c |}................o...
{c BLC}{hline 4}{c TT}{hline 4}{c TT}{hline 4}{c TT}{hline 4}{c TT}
{p 4 8 8}
{cmd:graph dot revenue, over(year) over(division)}{break}
Same as above, but ordered differently. In the previous example we
typed {cmd:over(division)} {cmd:over(year)}. This time, we reverse it:
division 1 year 1 {c |}....o...............
year 2 {c |}.o..................
{c |}
division 2 year 1 {c |}..........o.........
year 2 {c |}.......o............
{c |}
division 3 year 1 {c |}..............o.....
year 2 {c |}................o...
{c BLC}{hline 4}{c TT}{hline 4}{c TT}{hline 4}{c TT}{hline 4}{c TT}
{p 4 8 8}
{cmd:graph dot revenue profit, over(division) over(year)}{break}
{it:#_of_divisions}*{it:#_of_years} lines each with two markers, one
showing average revenue and the other showing average profit for each
division, repeated for each of the years.
{p 4 8 8}
{cmd:graph dot (sum) revenue profit, over(division) over(year)}{break}
{it:#_of_divisions}*{it:#_of_years} lines each with two markers, the first
showing the sum of revenue and the second showing the sum of profit for
each division, repeated for each of the years.
{p 4 8 8}
{cmd:graph dot (median) revenue profit, over(division) over(year)}{break}
{it:#_of_divisions}*{it:#_of_years} lines each with two markers showing
the median of revenue and median of profit for each division, repeated for
each of the years.
{p 4 8 8}
{cmd:graph dot (median) revenue (mean) profit, over(division) over(year)}{break}
{it:#_of_divisions}*{it:#_of_years} lines each with two markers showing
the median of revenue and mean of profit for each division, repeated for
each of the years.
{title:Also see}
{psee}
Manual: {bf:[G] graph dot}
{psee}
Online:
{helpb graph bar};
{helpb collapse}
{p_end}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -