Graph bihistograms: histograms for two categories shown in opposite directions > from the abscissa
bihist varname [if] [in] [weight], by(varname) [{ frequency |fraction | density } name(name_option) tw(twoway_options) tw1( twoway_options)]
Description
bihist makes a bihistogram, with frequencies (optionally fraction/density) of one variable by two categories of another variable shown above and below the abscissa (the x axis). Which category's histogram is above the axis and which is below depends on the ordering of the by() variable.
fweights, aweights, and pweights are allowed (at user's own risk).
Options
by is required. 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).
tw1(twoway_options) passes options to twoway_bar that are intended to apply only to the first by group (the lower set of bars). See the second example below.
Other options are passed to twoway__histogram_gen.
Examples
sysuse auto, clear bihist mpg, by(foreign)
sysuse nlsw88, clear bihist wage [fw=hours], by(married) frac la var married "" bihist wage [fw=hours], by(married) frac bihist wage [fw=hours], by(married) tw1(color(cyan)) tw(color(blue))
Author
Austin Nichols austinnichols@gmail.com
Also see:
Manual: [R] graph twoway bar
Online: help for histogram, twoway bar; byhist (if installed; install)