-------------------------------------------------------------------------------
help for tableplot
-------------------------------------------------------------------------------

Graphical display in two-way table format

tableplot plottype showvar rowvar colvar [if exp] [in range] [ , missing yasis xasis height(#) showval[(options)] graph_options [plot(plot) | addplot(plot)] ]

plottype is one of rbar, rcap, rcapsym or rspike.

Description

tableplot plots the values of showvar in a two-way table format. The categories of rowvar define rows from top (low values) to bottom (high values) and the categories of colvar define columns from left (low values) to right (high values). showvar for each combination of row and column is shown according to plottype, with default alignment vertical and, if plottype is rbar, default bar width 0.5. showvar must be unique for each such combination. By default both rowvar and colvar are mapped on the fly in sort order to successive integers from 1 up, but original values or value labels are used as value labels: this may be varied by use of the yasis or xasis options.

Remarks

The display is deliberately minimal. No numeric scales are shown for reading off numeric values, although optionally numeric values may be shown below bars by use of the showval option. Above all, there is no facility for any kind of three-dimensional display or effect.

In contrast to a table, in which it is easier to compare values down columns, it is usually easier to compare values across rows whenever alignment is vertical.

tableplot, by() is the way to do three-way tables. The variable specified in by() is used to produce a set of graphs in several panels.

Options

missing specifies that any missing values of any of the variables specified should also be included within their own categories.

yasis and xasis specify respectively that the y (row) variable and the x (column) variable are to be treated literally (that is, numerically). Most commonly, each option will be specified if the variable in question is a measured scale or a graded variable with gaps. If values 1 to 5 are labelled A to E, but no value of 4 (D) is present in the data, xasis or yasis prevents a mapping to 1 (A) ... 4 (E).

height(#) controls the amount of graph space taken up by bars. The default is 0.8 if all values of showvar are zero or positive and 0.5 otherwise. Note that the height may need to be much smaller or much larger with yasis or yasis, given that the latter take values literally.

showval specifies that numeric values are be shown beneath (or if horizontal is specified to the left of) bars. showval may also be specified with options. In particular,

showval(offset(#)) specifies an offset between the base of the bar and the position of the numeric value. Default is 0.1. Tweak this if the spacing is too large or too small.

showval(format(format)) specifies a format with which to show numeric values. Specifying a format will usually be advisable with non-integers. Example: showval(format(%2.1f)) specifies rounding to 1 decimal place.

Otherwise the options of showval() can be options of scatter, most usually marker label options.

graph_options refers to options of twoway rbar, twoway rcap, twoway rcapsym or twoway rspike, as appropriate. In particular:

barwidth() specifies the widths of the bars with rbar. The default is 0.5. This may need changing, especially with option xasis or yasis.

by() specifies another variable used to subdivide the display into panels.

plot(plot) provides a way to add other plots to the generated graph. Allowed in Stata 8 only.

addplot(addplot) provides a way to add other plots to the generated graph. Allowed in Stata 9 upwards.

Examples

. egen meanprice = mean(price), by(foreign rep78) . tableplot rbar meanprice for rep78 . tableplot rbar meanprice for rep78, showval(format(%4.0f))

Author

Nicholas J. Cox, Durham University, U.K. n.j.cox@durham.ac.uk

Also see

On-line: help for twoway, graph bar, graph hbar, graph dot, tabplot (if installed)