📄 axis_label_options.hlp
字号:
{smcl}
{* 07mar2005}{...}
{cmd:help axis_label_options}
{hline}
{* index ylabel() tt option}{...}
{* index xlabel() tt option}{...}
{* index tlabel() tt option}{...}
{* index ymlabel() tt option}{...}
{* index xmlabel() tt option}{...}
{* index tmlabel() tt option}{...}
{* index ytick() tt option}{...}
{* index xtick() tt option}{...}
{* index ttick() tt option}{...}
{* index ymtick() tt option}{...}
{* index xmtick() tt option}{...}
{* index tmtick() tt option}{...}
{* index axis labeling}{...}
{* index axis ticking}{...}
{* index grid lines}{...}
{title:Title}
{p2colset 5 31 33 2}{...}
{p2col :{hi:[G] {it:axis_label_options}} {hline 2}}Options for specifying axis labels{p_end}
{p2colreset}{...}
{title:Syntax}
{pstd}
{it:axis_label_options} are a subset of {it:axis_options}; see
{it:{help axis_options}}. {it:axis_label_options} control the
placement and the look of ticks and labels on an axis.
{it:axis_label_options}{col 42}description
{hline 70}
{c -(}{cmdab:y:}|{cmdab:x:}|{cmdab:t:}{c )-}{cmdab:lab:el:(}{it:rule_or_values}{cmd:)}{...}
{col 42}major ticks plus labels
{c -(}{cmdab:y:}|{cmdab:x:}|{cmdab:t:}{c )-}{cmdab:ti:ck:(}{it:rule_or_values}{cmd:)}{...}
{col 42}major ticks only
{c -(}{cmdab:y:}|{cmdab:x:}|{cmdab:t:}{c )-}{cmdab:mlab:el:(}{it:rule_or_values}{cmd:)}{...}
{col 42}minor ticks plus labels
{c -(}{cmdab:y:}|{cmdab:x:}|{cmdab:t:}{c )-}{cmdab:mti:ck:(}{it:rule_or_values}{cmd:)}{...}
{col 42}minor ticks only
{hline 70}
{pin}
The above options are {it:merged-explicit}; see {help repeated options}.
{pstd}
where {it:rule_or_values} is defined as
{p 8 16 2}
[{it:rule}]
[{it:numlist} [{cmd:"}{it:label}{cmd:"} [{it:numlist}
[{cmd:"}{it:label}{cmd:"} [...]]]]]
[{cmd:,} {it:suboptions}]
{pin}
where either {it:rule} or {it:numlist} must be specified and both may be
specified. {it:rule} may be
{it:rule}{col 18}example{col 30}description
{hline 70}
{cmd:#}{it:#}{...}
{col 18}{cmd:#6}{...}
{col 30}approximately 6 nice values
{cmd:##}{it:#}{...}
{col 18}{cmd:##10}{...}
{col 30}10-1=9 values between major ticks;
{col 30} allowed with {cmd:mlabel()} and {cmd:mtick()} only
{it:#}{cmd:(}{it:#}{cmd:)}{it:#}{...}
{col 18}{cmd:-4(.5)3}{...}
{col 30}specified range: -4 to 3 in steps of .5
{cmd:minmax}{...}
{col 18}{cmd:minmax}{...}
{col 30}minimum and maximum values
{cmd:none}{...}
{col 18}{cmd:none}{...}
{col 30}label no values
{cmd:.}{...}
{col 18}{cmd:.}{...}
{col 30}skip the rule
{hline 70}
{pin}
where {it:numlist} is as described in {help numlist}.
{pin}
{cmd:tlabel()},
{cmd:tmlabel()},
{cmd:ttick()}, and
{cmd:tmtick()} also accept a {it:datelist} and an extra type of {it:rule}
{it:rule}{col 22}example{col 40}description
{hline 70}
{it:date}{cmd:(}{it:#}{cmd:)}{it:date}{...}
{col 22}{cmd:1999m1(1)1999m12}{...}
{col 40}specified date range: each month
{col 42}assuming the axis has the {cmd:%tm} format
{hline 70}
{pin}
where {it:date} and {it:datelist} may contain dates, provided that the {it:t}
(time) axis has a date format; see {help datelist}.
{it:suboptions}{col 42}description
{hline 70}
{cmdab:ax:is:(}{it:#}{cmd:)}{...}
{col 42}which axis, 1 {ul:<} {it:#} {ul:<} 9
{cmd:add}{...}
{col 42}combine options
[{cmdab:no:}]{cmdab:tick:s}{...}
{col 42}suppress ticks
[{cmdab:no:}]{cmdab:lab:els}{...}
{col 42}suppress labels
{cmdab:val:uelabel}{...}
{col 42}label values using first variable's
{col 42} value label
{cmd:format(}{help format:{bf:%}{it:fmt}}{cmd:)}{...}
{col 42}format values per {cmd:%}{it:fmt}
{cmd:angle(}{it:{help anglestyle}}{cmd:)}{...}
{col 42}angle the labels
{cmdab:alt:ernate}{...}
{col 42}offset adjacent labels
{cmdab:tsty:le:(}{it:{help tickstyle}}{cmd:)}{...}
{col 42}labels and ticks: overall style
{cmd:labgap(}{it:{help relativesize}}{cmd:)}{...}
{col 42}labels: margin between tick and label
{cmd:labstyle(}{it:{help textstyle}}{cmd:)}{...}
{col 42}labels: overall style
{cmdab:labs:ize:(}{it:{help textsizestyle}}{cmd:)}{...}
{col 42}labels: size of text
{cmdab:labc:olor:(}{it:{help colorstyle}}{cmd:)}{...}
{col 42}labels: color of text
{cmdab:tl:ength:(}{it:{help relativesize}}{cmd:)}{...}
{col 42}ticks: length
{cmdab:tp:osition:(}{...}
{cmdab:o:utside}|{cmdab:c:rossing}|
{cmdab:i:nside:)}{...}
{col 42}ticks: position/direction
{cmdab:tlsty:le:(}{it:{help linestyle}}{cmd:)}{...}
{col 42}ticks: linestyle of
{cmdab:tlw:idth:(}{it:{help linewidthstyle}}{cmd:)}{...}
{col 42}ticks: thickness of line
{cmdab:tlc:olor:(}{it:{help colorstyle}}{cmd:)}{...}
{col 42}ticks: color of line
{cmdab:tlp:attern(}{it:{help linepatternstyle}}{cmd:)}{...}
{col 42}ticks: line pattern of line
[{cmd:no}]{cmd:grid}{...}
{col 42}grid: include
[{cmd:no}]{cmd:gmin}{...}
{col 42}grid: grid line at minimum
[{cmd:no}]{cmd:gmax}{...}
{col 42}grid: grid line at maximum
{cmdab:gsty:le:(}{it:{help gridstyle}}{cmd:)}{...}
{col 42}grid: overall style
[{cmdab:no:}]{cmdab:gex:tend}{...}
{col 42}grid: extend into plot region margin
{cmdab:glsty:le:(}{it:{help linestyle}}{cmd:)}{...}
{col 42}grid: linestyle of
{cmdab:glw:idth:(}{it:{help linewidthstyle}}{cmd:)}{...}
{col 42}grid: thickness of line
{cmdab:glc:olor:(}{it:{help colorstyle}}{cmd:)}{...}
{col 42}grid: color of line
{cmdab:glp:attern(}{it:{help linepatternstyle}}{cmd:)}{...}
{col 42}grid: line pattern of line
{hline 70}
{title:Description}
{pstd}
{it:axis_label_options} control the placement and the look of ticks and labels
on an axis.
{title:Options}
{phang}
{cmd:ylabel}({it:rule_or_values{cmd:)}},
{cmd:xlabel(}{it:rule_or_values{cmd:)}}, and
{cmd:tlabel(}{it:rule_or_values{cmd:)}}
specify the major values to be labeled and ticked along the axis. For
instance, to label the values 0, 5, 10, ..., 25 along the {it:x} axis,
specify {cmd:xlabel(0(5)25)}. If the {it:t} axis has the {cmd:%tm}
format, {cmd:tlabel(1999m1(1)1999m12)} will label all the months in 1999.
{phang}
{cmd:ytick}({it:rule_or_values{cmd:)}},
{cmd:xtick(}{it:rule_or_values{cmd:)}}, and
{cmd:ttick(}{it:rule_or_values{cmd:)}}
specify the major values to be ticked but not labeled along the axis.
For instance, to tick the values 0, 5, 10, ..., 25 along the {it:x} axis,
specify {cmd:xtick(0(5)25)}. Specify {cmd:ttick(1999m1(1)1999m12)} to
place ticks for each month in the year 1999.
{phang}
{cmd:ymlabel(}{it:rule_or_values{cmd:)}},
{cmd:xmlabel(}{it:rule_or_values{cmd:)}}, and
{cmd:tmlabel(}{it:rule_or_values{cmd:)}}
specify minor values to be labeled and ticked along the axis.
{phang}
{cmd:ymtick(}{it:rule_or_values{cmd:)}},
{cmd:xmtick(}{it:rule_or_values{cmd:)}}, and
{cmd:tmtick(}{it:rule_or_values{cmd:)}}
specify minor values to be ticked along the axis.
{title:Suboptions}
{phang}
{cmd:axis(}{it:#}{cmd:)}
specifies to which scale this axis belongs and is specified when dealing
with multiple {it:x} ({it:t}) or {it:y} axes; see
{it:{help axis_choice_options}}.
{phang}
{cmd:add}
specifies that what is specified is to be added to any previous
{cmd:xlabel()}, {cmd:ylabel()}, {cmd:xtick()}, ..., or {cmd:ymtick()}
option previously specified.
See {hi:Interpretation of repeated options} below.
{phang}
{cmd:noticks} and {cmd:ticks} suppress/force the drawing of ticks.
{cmd:ticks} is the usual default, so {cmd:noticks}
makes
{c -(}{cmd:y}|{cmd:x}{c )-}{cmd:label()}
and
{c -(}{cmd:y}|{cmd:x}{c )-}{cmd:mlabel()}
display the labels only.
{phang}
{cmd:nolabels} and {cmd:labels}
suppress/force the display of the labels.
{cmd:labels} is the usual default, so {cmd:nolabels}
turns
{c -(}{cmd:y}|{cmd:x}{c )-}{cmd:label()}
into
{c -(}{cmd:y}|{cmd:x}{c )-}{cmd:tick()}
and
{c -(}{cmd:y}|{cmd:x}{c )-}{cmd:mlabel()}
into
{c -(}{cmd:y}|{cmd:x}{c )-}{cmd:mtick()}.
Why anyone would want to do this is difficult to imagine.
{phang}
{cmd:valuelabel} specifies
that values should be mapped through
the first {it:y} variable's value label ({cmd:y}{it:*}{cmd:()} options)
or the {it:x} variable's value label
({cmd:x}{it:*}{cmd:()} options).
Consider the command "{cmd:scatter yvar xvar}" and assume that {cmd:xvar}
has been previously given a value label:
{cmd:. label define cat 1 "Low" 2 "Med" 3 "Hi"}
{cmd:. label values xvar cat}
{p 8 8 2}
Then
{p 12 16 2}
{cmd:. scatter yvar xvar, xlabel(1 2 3, valuelabel)}
{p 8 8 2}
would, rather than putting the numbers 1, 2, and 3, put the words Low,
Med, and Hi on the {it:x} axis. It would have the same effect as
{p 12 16 2}
{cmd:scatter yvar xvar, xlabel(1 "Low" 2 "Med" 3 "Hi")}
{phang}
{cmd:format(%}{it:fmt}{cmd:)}
specifies how numeric values on the axes should be formatted. The default
{cmd:format()} is obtained from the variables specified with the
{cmd:graph} command, which for {cmd:ylabel()}, {cmd:ytick()},
{cmd:ymlabel()}, and {cmd:ymtick()} usually means the first {it:y}
variable, and for {cmd:xlabel()}, ..., {cmd:xmtick()}, means the {it:x}
variable. For instance, in
{p 16 20 2}
{cmd:. scatter y1var y2var xvar}
{p 8 8 2}
the default format for the {it:y} axis would be {cmd:y1var}'s
format, and the default for the {it:x} axis would be {cmd:xvar}'s format.
{p 8 8 2}
You may specify the {cmd:format()} suboption (or any suboption)
without specifying values if you want the default labeling presented
differently. For instance,
{p 16 20 2}
{cmd:. scatter y1var y2var xvar, ylabel(,format(%9.2fc))}
{p 8 8 2}
would present default labeling of the {it:y} axis, but the numbers would
be formatted with the {cmd:%9.2fc} format. Note carefully the comma
in front of {cmd:format}. Inside the {cmd:ylabel()} option, we are
specifying suboptions only.
{phang}
{cmd:angle(}{it:anglestyle}{cmd:)}
causes the labels to be presented at an angle.
See {it:{help anglestyle}}.
{phang}
{cmd:alternate}
causes adjacent labels to be offset from one another and is useful when
many values are being labeled. For instance, rather than obtaining
{hline 2}{c TT}{hline 3}{c TT}{hline 3}{c TT}{hline 3}{c TT}{hline 3}{c TT}{hline 3}{c TT}{hline 3}{c TT}{hline 2}
1.0 1.1 1.2 1.3 1.4 1.5 1.6
{p 8 8 2}
with {cmd:alternate}, you would obtain
{hline 2}{c TT}{hline 3}{c TT}{hline 3}{c TT}{hline 3}{c TT}{hline 3}{c TT}{hline 3}{c TT}{hline 3}{c TT}{hline 2}
1.0 1.2 1.4 1.6
1.1 1.3 1.5
{phang}
{opth tstyle(tickstyle)}
specifies the overall look of ticks and labels.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -