Stata 15 help for twoway_options

[G-3] twoway_options -- Options for twoway graphs

Syntax

The twoway_options allowed with all twoway graphs are

twoway_options Description ------------------------------------------------------------------------- added_line_options draw lines at specified y or x values added_text_options display text at specified (y,x) value

axis_options labels, ticks, grids, log scales title_options titles, subtitles, notes, captions legend_options legend explaining what means what

scale(#) resize text, markers, and line widths region_options outlining, shading, graph size aspect_option constrain aspect ratio of plot region scheme(schemename) overall look play(recordingname) play edits from recordingname

by(varlist, ...) repeat for subgroups nodraw suppress display of graph name(name, ...) specify name for graph saving(filename, ...) save graph in file

advanced_options difficult to explain -------------------------------------------------------------------------

Description

The above options are allowed with all plottypes (scatter, line, etc.) allowed by graph twoway.

Options

added_line_options specify that horizontal or vertical lines be drawn on the graph; see [G-3] added_line_options. If your interest is in drawing grid lines through the plot region, see axis_options below.

added_text_options specifies text to be displayed on the graph (inside the plot region); see [G-3] added_text_options.

axis_options specify how the axes are to look, including values to be labeled or ticked on the axes. These options also allow you to obtain logarithmic scales and grid lines. See [G-3] axis_options.

title_options allow you to specify titles, subtitles, notes, and captions to be placed on the graph; see [G-3] title_options.

legend_options specifies whether a legend is to appear and allows you to modify the legend's contents. See [G-3] legend_options.

scale(#) specifies a multiplier that affects the size of all text, markers, and line widths in a graph. scale(1) is the default, and scale(1.2) would make all text, markers, and line widths 20% larger. See [G-3] scale_option.

region_options allow outlining the plot region (such as placing or suppressing a border around the graph), specifying a background shading for the region, and controlling the graph size. See [G-3] region_options.

aspect_option allows you to control the relationship between the height and width of a graph's plot region; see [G-3] aspect_option.

scheme(schemename) specifies the overall look of the graph; see [G-3] scheme_option.

play(recordingname) applies the edits from recordingname to the graph, where recordingname is the name under which edits previously made in the Graph Editor have been recorded and stored. See Graph Recorder in [G-1] graph editor.

by(varlist, ...) specifies that the plot be repeated for each set of values of varlist; see [G-3] by_option.

nodraw causes the graph to be constructed but not displayed; see [G-3] nodraw_option.

name(name[, replace]) specifies the name of the graph. name(Graph, replace) is the default. See [G-3] name_option.

saving(filename[, asis replace]) specifies that the graph be saved as filename. If filename is specified without an extension, .gph is assumed. asis specifies that the graph be saved just as it is. replace specifies that, if the file already exists, it is okay to replace it. See [G-3] saving_option.

advanced_options are not so much advanced as they are difficult to explain and are rarely used. They are also invaluable when you need them; see [G-3] advanced_options.

Remarks

The above options may be used with any of the twoway plottypes -- see [G-2] graph twoway -- for instance,

. twoway scatter mpg weight, by(foreign)

. twoway line le year, xlabel(,grid) saving(myfile, replace)

The above options are options of twoway, meaning that they affect the entire twoway graph and not just one or the other of the plots on it. For instance, in

. twoway lfitci mpg weight, stdf || scatter mpg weight, ms(O) by(foreign, total row(1))

the by() option applies to the entire graph, and in theory you should type

. twoway lfitci mpg weight, stdf || scatter mpg weight, ms(O) ||, by(foreign, total row(1))

or

. twoway (lfitci mpg weight, stdf) (scatter mpg weight, ms(O)), by(foreign, total row(1))

to demonstrate your understanding of that fact. You need not do that, however, and in fact it does not matter to which plot you attach the twoway_options. You could even type

. twoway lfitci mpg weight, stdf by(foreign, total row(1)) || scatter mpg weight, ms(O)

and, when specifying multiple twoway_options, you could even attach some to one plot and the others to another:

. twoway lfitci mpg weight, stdf by(foreign, total row(1)) || scatter mpg weight, ms(O) saving(myfile)


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