Stata 15 help for added_line_options

[G-3] 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 lalign(linealignmentstyle) outline alignment (inside, outside, center) lcolor(colorstyle) color and opacity 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-3] 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. See [G-4] addedlinestyle. 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-3] 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-4] schemes intro.

lstyle(linestyle), lpattern(linepatternstyle), lwidth(linewidthstyle), lalign(linealignmentstyle), and lcolor(colorstyle) specify the look of the line; see [G-2] 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-3] 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))


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index