help added_line_options
-------------------------------------------------------------------------------
Title
[G] added_line_options --}Options for adding lines to twoway graphs
Syntax
added_line_options description
---------------------------------------------------------------------
yline(linearg) add horizontal lines at specified y
values
xline(linearg) add vertical lines at specified x
values
tline(time_linearg) add vertical lines at specified t
values
---------------------------------------------------------------------
yline(), xline(), and tline() are merged-implicit; see repeated
options and see Interpretation of repeated options below.
where linearg is
numlist [, suboptions]
For a description of numlist, see numlist.
and time_linearg is
datelist [, suboptions]
For a description of datelist, see datelist.
suboptions description
---------------------------------------------------------------------
axis(#) which axis to use, 1 < # < 9
style(addedlinestyle) overall style of added line
[no]extend extend line through plot region's
margins
lstyle(linestyle) overall style of line
lpattern(linepatternstyle) line pattern (solid, dashed, etc.)
lwidth(linewidthstyle) thickness of line
lcolor(colorstyle) color of line
---------------------------------------------------------------------
Description
yline(), xline(), and tline() are used with twoway to add lines to the
plot region. tline() is an extension to xline(); see [TS] tsline for
examples using tline().
Options
yline(linearg), xline(linearg), and tline(time_linearg) specify the y, x,
and t (time) values where lines should be added to the plot.
Suboptions
axis(#) is for use only when multiple y, x, or t axes are being used (see
> [G] axis_choice_options). axis() specifies to which axis the
yline(), xline(), or tline() is to be applied.
style(addedlinestyle) specifies the overall style of the added line,
which includes [no]extend and lstyle(linestyle) documented below.
The [no]extend and lstyle() options allow you to change the added
line's attributes individually, but style() is the starting point.
You need not specify style() just because there is something that you
want to change, and in fact, most people seldom specify the style()
option. You specify style() 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.
extend and noextend specify whether the line should extend through the
plot region's margin and touch the axis; see [G] region_options.
Usually noextend is the default, and extend is the option, but that
is determined by the overall style() and, of course, the scheme; see
[G] schemes intro.
lstyle(linestyle), lpattern(linepatternstyle), lwidth(linewidthstyle),
and lcolor(colorstyle) specify the look of the line; see [G] graph
twoway line. lstyle() can be of particular use:
To create a line with the same look as the lines used to draw axes,
specify lstyle(foreground).
To create a line with the same look as the lines used to draw grid
lines, specify lstyle(grid).
Remarks
yline() and xline() add lines where specified. If, however, your
interest is in obtaining grid lines, see the grid option in [G]
axis_label_options.
Remarks are presented under the following headings:
Typical use
Interpretation of repeated options
Typical use
yline() or xline() are typically used to add reference values:
. scatter yvar xvar, yline(10)
. scatter yvar year, xline(1944 1989)
To give the line in the first example the same look as used to draw an
axis, we could specify
. scatter yvar xvar, yline(10, lstyle(foreground))
If we wanted to give the lines used in the second example the same look
as used to draw grids, we could specify
. scatter yvar year, xline(1944 1989, lstyle(grid))
Interpretation of repeated options
Options yline() and xline() may be repeated, and each is executed
separately. Thus different styles can be used for different lines on the
same graph:
. scatter yvar year, xline(1944) xline(1989, lwidth(3))
Also see
Manual: [G] added_line_options
Help: [G] graph twoway; [U] 11.1.9 datelist; [G] linestyle, [G]
linepatternstyle, [G] linewidthstyle, [G] colorstyle