📄 marker_label_options.hlp
字号:
{smcl}
{* 05mar2005}{...}
{cmd:help marker_label_options}
{hline}
{* index markers, also see marker labels}{...}
{* index marker labels}{...}
{* index mlabel() tt option}{...}
{* index mlabstyle() tt option}{...}
{* index mlabposition() tt option}{...}
{* index mlabvposition() tt option}{...}
{* index mlabgap() tt option}{...}
{* index mlabangle() tt option}{...}
{* index mlabtextstyle() tt option}{...}
{* index mlabsize() tt option}{...}
{* index mlabcolor() tt option}{...}
{title:Title}
{p2colset 5 33 35 2}{...}
{p2col :{hi:[G] {it:marker_label_options}} {hline 2}}Options for specifying marker labels{p_end}
{p2colreset}{...}
{title:Syntax}
{it:marker_label_options}{col 44}description
{hline 63}
{cmdab:ml:abel(}{it:varname}{cmd:)}{...}
{col 44}specify marker variable
{cmdab:mlabsty:le:(}{it:{help markerlabelstyle}}{cmd:)}{...}
{col 44}overall style of label
{cmdab:mlabp:osition:(}{it:{help clockposstyle}}{cmd:)}{...}
{col 44}where to locate the label
{cmdab:mlabv:position:(}{it:varname}{cmd:)}{...}
{col 44}where to locate the label 2
{cmdab:mlabg:ap:(}{it:{help relativesize}}{cmd:)}{...}
{col 44}gap between marker and label
{cmdab:mlabang:le:(}{it:{help anglestyle}}{cmd:)}{...}
{col 44}angle of label
{cmdab:mlabt:extstyle:(}{it:{help textstyle}}{cmd:)}{...}
{col 44}overall style of text
{cmdab:mlabs:ize:(}{it:{help textsizestyle}}{cmd:)}{...}
{col 44}size of label
{cmdab:mlabc:olor:(}{it:{help colorstyle}}{cmd:)}{...}
{col 44}color of label
{hline 63}
{pin}
All options are {it:rightmost}; see {help repeated options}.
{phang}
In some cases{hline 2}such as when used with {cmd:scatter}{hline 2}lists are
allowed inside the arguments. A list is a sequence of the elements separated
by spaces. Shorthands are allowed to make specifying the list easier; see
{it:{help stylelists}}. When lists are allowed, option {cmd:mlabel()}
allows a {it:varlist} in place of a {it:varname}.
{title:Description}
{pstd}
Marker labels are labels that appear next to (or in place of) markers.
Markers are the ink used to mark where points are on a plot.
{title:Options}
{phang}
{cmd:mlabel(}{it:varname}{cmd:)}
specifies the (usually string) variable to be used that provides,
observation by observation, the marker "text".
For instance, you might have
{cmd:. sysuse auto, clear}
{cmd}. list mpg weight make in 1/4
{txt}
{c TLC}{hline 5}{c -}{hline 8}{c -}{hline 15}{c TRC}
{c |} {res}mpg weight make {txt}{c |}
{c LT}{hline 5}{c -}{hline 8}{c -}{hline 15}{c RT}
1. {c |} {res} 22 2930 AMC Concord {txt}{c |}
2. {c |} {res} 17 3350 AMC Pacer {txt}{c |}
3. {c |} {res} 22 2640 AMC Spirit {txt}{c |}
4. {c |} {res} 20 3250 Buick Century {txt}{c |}
{c BLC}{hline 5}{c -}{hline 8}{c -}{hline 15}{c BRC}{txt}
{pmore}
Typing
{cmd:. scatter mpg weight, mlabel(make)}
{pmore}
would draw a scatter of {cmd:mpg} versus
{cmd:weight} and label each point in
the scatter according to its {cmd:make}. (We recommend that you include
"{cmd:in 1/10}" on the above command. Marker labels only work well when
there is a small amount of data.)
{phang}
{cmd:mlabstyle(}{it:markerlabelstyle}{cmd:)}
specifies the overall look of marker labels, including their position,
their size, their text style, etc. The other options documented below
allow you to change each attribute of the marker label, but
{cmd:mlabstyle()} is the starting point.
{pmore}
You need not specify {cmd:mlabstyle()} just because there is something you
want to change about the look of a marker and, in fact, most people seldom
specify the {cmd:mlabstyle()} option. You specify {cmd:mlabstyle()} when
another style exists that is exactly what you desire or when another style
would allow you to specify fewer changes to obtain what you want.
{phang}
{cmd:mlabposition(}{it:clockposstyle}{cmd:)}
and
{cmd:mlabvposition(}{it:varname}{cmd:)}
specify where the label is to be located relative to the point.
{cmd:mlabposition()} and {cmd:mlabvposition()} are alternatives; the first
specifies a constant position for all points, and the second specifies
a variable that contains {it:clockposstyle} (a number 0 through 12) for each
point. If both options are specified, {cmd:mlabvposition()} takes
precedence.
{pmore}
If neither option is specified, the default is {cmd:mlabposition(3)}
(3 o'clock){hline 2}meaning to the right of the point.
{pmore}
{cmd:mlabposition(12)} means above the point, {cmd:mlabposition(1)} means
above and to the right of the point, and so on. {cmd:mlabposition(0)}
means that the label is to be put directly on top of
the point (in which case remember to also specify the {cmd:msymbol(i)}
option so that the marker does not also display; see
{it:{help marker_options}}).
{pmore}
{cmd:mlabvposition(}{it:varname}{cmd:)} specifies a numeric variable
containing values 0 through 12, which are used, observation by observation,
to locate the labels relative to the points.
{pmore}
See {it:{help clockposstyle}} for more information on specifying
{it:clockposstyle}.
{phang}
{cmd:mlabgap(}{it:relativesize}{cmd:)}
specifies how much space should be put between the marker and the label.
See {it:{help relativesize}}.
{phang}
{cmd:mlabangle(}{it:anglestyle}{cmd:)}
specifies the angle of text.
The default is usually {cmd:mlabangle(horizontal)}.
See {it:{help anglestyle}}.
{phang}
{cmd:mlabtextstyle(}{it:textstyle}{cmd:)}
specifies the overall look of text of the marker labels, which in this
case means their size and color. When you see {help textstyle},
you will find that a textstyle defines much more, but all those other
things are ignored in the case of marker labels. In any case,
the {cmd:mlabsize()} and {cmd:mlabcolor()} options documented below
allow you to change the size and color, but the {cmd:mlabtextstyle} is
the starting point.
{pmore}
As with {cmd:mlabstyle()}, you need not specify {cmd:mlabtextstyle()} just
because there is something you want to change. You specify
{cmd:mlabtextstyle()} when another style exists that is exactly what you
desire or when another style would allow you to specify fewer changes to
obtain what you want.
{phang}
{cmd:mlabsize(}{it:textsizestyle}{cmd:)}
specifies the size of the text.
See {it:{help textsizestyle}}.
{phang}
{cmd:mlabcolor(}{it:colorstyle}{cmd:)}
specifies the color of the text.
See {it:{help colorstyle}}.
{title:Remarks}
{pstd}
Remarks are presented under the headings
{help marker_label_options##remarks1:Typical use}
{help marker_label_options##remarks2:Eliminating overprinting and overruns}
{help marker_label_options##remarks3:Advanced use}
{help marker_label_options##remarks4:Using marker labels in place of markers}
{marker remarks1}{...}
{title:Typical use}
{pstd}
Markers are the ink used to mark where points are on a plot, and marker labels
optionally appear beside the markers to identify the points. For instance, if
you were plotting country data, marker labels would allow you to have
"Argentina", "Bolivia", ..., appear next to each point. Marker
labels visually work well when there is a small amount of data.
{pstd}
To obtain marker labels, you specify the {cmd:mlabel(}{it:varname}{cmd:)}
option, such as {cmd:mlabel(country)}. {it:varname} is the name of a variable
that, observation by observation, specifies the text with which the point is
to be labeled. {it:varname} may be a string or numeric variable, but usually
it is a string. For instance, consider the South American subset of the life
expectancy by country data:
{cmd:. sysuse lifeexp, clear}
{cmd}. list country lexp gnppc if region==2
{txt}
{c TLC}{hline 21}{c -}{hline 6}{c -}{hline 7}{c TRC}
{c |} {res} country lexp gnppc {txt}{c |}
{c LT}{hline 21}{c -}{hline 6}{c -}{hline 7}{c RT}
45. {c |} {res} Canada 79 19170 {txt}{c |}
46. {c |} {res} Cuba 76 . {txt}{c |}
47. {c |} {res} Dominican Republic 71 1770 {txt}{c |}
48. {c |} {res} El Salvador 69 1850 {txt}{c |}
49. {c |} {res} Guatemala 64 1640 {txt}{c |}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -