-------------------------------------------------------------------------------
help for byhist
-------------------------------------------------------------------------------

Graph interlaced histograms: for comparing histograms by a categorical variable

byhist varname [if] [in] [weight] [, by(varname) { frequency |fraction | density } name(name_option) tw(twoway_options)]

Description

byhist makes histograms, with frequencies (optionally fraction/density) of one variable optionally shown by categories of another variable. fweights, aweights, and pweights are allowed (at user's own risk).

Options

by specifies a variable by which to compute histograms. Options after a comma within the parentheses are passed to twoway_bar.

frequency |fraction | density are as in histogram.

name names the graph something other than "Graph"; see name_option.

tw(twoway_options) passes options to twoway_bar. Note that options passed by default may be superseded in this way, for example y axis labels, but some added options may be ignored as a result of existing options (e.g. yscale will not override the range specified by the existing y axis labels).

tw?(twoway_options) passes options to twoway_bar. This is a set of options tw1(twoway_options), tw2(twoway_options), tw3( twoway_options), et cetera, that pass twoway_options to the first set of bars, the second set of bars, the third set of bars, and so on. See the second example below.

Other options are passed to twoway__histogram_gen.

Examples

sysuse auto, clear byhist mpg, by(foreign)

sysuse nlsw88, clear byhist wage [fw=hours], by(married) frac la var married "" byhist wage [fw=hours], by(married) frac byhist wage [fw=hours], by(married) frac tw1(color(blue)) tw2(color(cyan))

Author

Austin Nichols austinnichols@gmail.com

Also see:

Manual: [R] graph twoway bar

Online: help for histogram, twoway bar; bihist (if installed; install)