.BG
.VE $Header: /usr3/s/current/s/.help/RCS/barplot,v 1.3 83/12/30 19:24:32 rab Exp $
.FN barplot
.TL
barplot: Bar Graph
.CS
barplot(height)  #simple form
barplot(height, width, names, space, inside, beside, horiz,
        legend, angle, density, col, blocks)
.PP
.AG height
matrix or vector giving the heights (positive or negative) of the bars.
If `height' is a matrix, each column represents one bar;
the values in the columns are treated as heights of blocks.
Blocks of positive height are stacked above the
zero line and those with negative height are stacked below the line.
Matrix values in `height' can also be treated as the positions of the
dividing lines; see argument `blocks'.
.AG width
optional vector of relative bar widths.
.AG names
optional character vector of names for the bars.
.AG space
how much space (as a fraction of the average bar width)
should be left before each bar.
This may be given as a single number or one number per bar.
A value of .2 is the default spacing.
If `beside' is TRUE, `space' may be specified by 2 numbers
where the first is the space between bars in a set,
and the second is the space between sets.
.AG inside
if TRUE (default), the internal lines which
divide adjacent bars will be drawn.
.AG beside
if TRUE and if `height' is a matrix, the bars for different rows will
be plotted beside each other, not as a single divided bar.
Default FALSE.
If `width' is given in the case beside=TRUE,
there must be as many widths as the number of
values in `heights', not the number of columns.
The same is true of `names', if this is supplied.
.AG horiz
if TRUE, the graph will be drawn horizontally, with
the first bar at the bottom. Default is FALSE.
.AG legend
a vector of names to be correlated with the bar shading which should be
plotted as a legend.
The legend is put in the upper right of the plot by default;
use the `legend' function if more control over legend positioning is required.
.AG angle
optional vector giving the angle (degrees, counter-clockwise
from horizontal) for shading each bar division.
(Defaults to 45 if `density' is supplied.)
.AG density
optional vector for bar shading, giving the number of lines
per inch for shading each bar division.
(Defaults to 3 if `angle' is supplied).
.AG col
optional vector giving the colors in which the bars should
be filled or shaded.
If `col' is specified and neither `angle' nor `density' are given
as arguments, bars will be filled solidly with the colors.
If `angle' or `density' are given,
`col' refers to the color of the shading lines.
.AG blocks
if TRUE (the default), the `height' matrix is treated according to
the "blocks" model in which each value in `height' is the height of
a block to be stacked above or below the axis.
If `blocks' is FALSE, values in `height' give the coordinates at which
the bar dividing lines are to be drawn.  In this case, the values in
any column of `height' should be monotonically increasing.
.PP
Solid filling of bars is dependent on the area-filling capability
of the device driver.  For devices without explicit area-filling capability,
solid filling can be simulated by specifying a very high density shading.
.PP
Graphical parameters may also be supplied as arguments to this
function (see `par').
.RT
a vector, non-printing, which contains
x-coordinates of
centers of bars (y-coordinates if bars are horizontal).
The returned value is useful if the user wants to add to the plot.
.EX
x <- barplot(height)  # do plot, save x coordinates of bar centers
text(x,height+1,height)  # label the tops of the bars

# The example plot was produced by
barplot(
      t(telsam.response[1:5,]),
      ylim=c(0,200),
      col=2:5,angle=c(5,40,80,125),density=(4:7)*3,
      legend=telsam.collab,
      names=encode(telsam.rowlab[1:5]),
      xlab="Interviewer",
      ylab="Number of Responses",
      main="Response to Quality of Service Question"
      )
.PI
.KW plot*
.KW histogram
.KW reports
.KW hplot*
.WR
