Bar plot, with optional error bars -----------------------------------
^barplot2^ yvar xvar [^if^ exp] [^in^ range] [ ^, w^idth^(^string^) b^ase^(^string^) e^rror^(^errorvar^)^ graph_options ]
Description ------------
^barplot2^ produces a bar plot of yvar against xvar. yvar is plotted as a series of unshaded bars rising above or falling below a base line. The height of each bar is given by yvar, the width via the width option, the base via the base option and the horizontal centre of each bar by xvar.
Through the ^width()^ option, ^barplot2^ could be used to produce overlapping or underlapping bars, if desired for some reason.
Through the ^error()^ option, error bars may be added to each bar.
Options --------
^width(^string^)^ specifies how the widths of the bars are determined. ^width(^widthvar^)^ specifies that they are given by widthvar. ^width(^#^)^ specifies that they are constant and equal to #. The default is ^width(1)^.
^base(^string^)^ specifies how the bases of the bars are determined. ^base(^basevar^)^ specifies that they are given by basevar. ^base(^#^)^ specifies that they are constant and equal to #. The default is ^base(0)^.
^error(^errorvar^)^ specifies an variable containing errors. Error bars will be drawn as capped vertical lines connecting yvar +/- errorvar.
graph_options are options allowed with ^graph, twoway^, other than ^symbol^ and ^connect^, and ^xlabel^ by itself. Note that these options do not include ^shading^.
Examples ---------
. ^barplot2 pop age^
. ^barplot2 meanmpg rep78, w(0.5) e(error) xla(1,2,3,4,5)^
Histogram with unequal bin widths (Snedecor and Cochran, 1989, p.19):
. ^input centre width freq^ . ^112.5 25 38^ . ^137.5 25 27^ . ^162.5 25 15^ . ^187.5 25 11^ . ^250 100 4^ . ^350 100 4^ . ^450 100 1.8^ . ^550 100 2^ . ^700 200 1.2^ . ^900 200 0.2^ . ^barplot2 freq centre, w(width) l2(Frequency per 25000)^ ^b2(Population in 000) yla^
Author -------
Nicholas J. Cox, University of Durham, U.K. n.j.cox@@durham.ac.uk
Also see ---------
On-line: help for @graph@, @barplot@ (if installed), @serrbar@