The R Project SVN R

Rev

Rev 30448 | Rev 36222 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 30448 Rev 34030
Line 9... Line 9...
9
\method{barplot}{default}(height, width = 1, space = NULL,
9
\method{barplot}{default}(height, width = 1, space = NULL,
10
        names.arg = NULL, legend.text = NULL, beside = FALSE,
10
        names.arg = NULL, legend.text = NULL, beside = FALSE,
11
        horiz = FALSE, density = NULL, angle = 45,
11
        horiz = FALSE, density = NULL, angle = 45,
12
        col = NULL, border = par("fg"),
12
        col = NULL, border = par("fg"),
13
        main = NULL, sub = NULL, xlab = NULL, ylab = NULL,
13
        main = NULL, sub = NULL, xlab = NULL, ylab = NULL,
14
        xlim = NULL, ylim = NULL, xpd = TRUE,
14
        xlim = NULL, ylim = NULL, xpd = TRUE, log = "",
15
        axes = TRUE, axisnames = TRUE,
15
        axes = TRUE, axisnames = TRUE,
16
        cex.axis = par("cex.axis"), cex.names = par("cex.axis"),
16
        cex.axis = par("cex.axis"), cex.names = par("cex.axis"),
17
        inside = TRUE, plot = TRUE, axis.lty = 0, offset = 0, \dots)
17
        inside = TRUE, plot = TRUE, axis.lty = 0, offset = 0,
-
 
18
        add = FALSE, \dots)
18
}
19
}
19
\arguments{
20
\arguments{
20
  \item{height}{either a vector or matrix of values describing the
21
  \item{height}{either a vector or matrix of values describing the
21
    bars which make up the plot.  If \code{height} is a vector, the
22
    bars which make up the plot.  If \code{height} is a vector, the
22
    plot consists of a sequence of rectangular bars with heights
23
    plot consists of a sequence of rectangular bars with heights
Line 70... Line 71...
70
  \item{xlab}{a label for the x axis.}
71
  \item{xlab}{a label for the x axis.}
71
  \item{ylab}{a label for the y axis.}
72
  \item{ylab}{a label for the y axis.}
72
  \item{xlim}{limits for the x axis.}
73
  \item{xlim}{limits for the x axis.}
73
  \item{ylim}{limits for the y axis.}
74
  \item{ylim}{limits for the y axis.}
74
  \item{xpd}{logical. Should bars be allowed to go outside region?}
75
  \item{xpd}{logical. Should bars be allowed to go outside region?}
-
 
76
  \item{log}{string specifying if axis scales should be logarithmic; see
-
 
77
    \code{\link{plot.default}}.}
75
  \item{axes}{logical.  If \code{TRUE}, a vertical (or horizontal, if
78
  \item{axes}{logical.  If \code{TRUE}, a vertical (or horizontal, if
76
    \code{horiz} is true) axis is drawn.}
79
    \code{horiz} is true) axis is drawn.}
77
  \item{axisnames}{logical.  If \code{TRUE}, and if there are
80
  \item{axisnames}{logical.  If \code{TRUE}, and if there are
78
    \code{names.arg} (see above), the
81
    \code{names.arg} (see above), the
79
    other axis is drawn (with \code{lty=0}) and labeled.}
82
    other axis is drawn (with \code{lty=0}) and labeled.}
Line 88... Line 91...
88
  \item{axis.lty}{the graphics parameter \code{lty} applied to the axis
91
  \item{axis.lty}{the graphics parameter \code{lty} applied to the axis
89
    and tick marks of the categorical (default horizontal) axis.  Note
92
    and tick marks of the categorical (default horizontal) axis.  Note
90
    that by default the axis is suppressed.}
93
    that by default the axis is suppressed.}
91
  \item{offset}{a vector indicating how much the bars should be shifted
94
  \item{offset}{a vector indicating how much the bars should be shifted
92
    relative to the x axis.}
95
    relative to the x axis.}
-
 
96
  \item{add}{logical specifying if bars should be added to an already
-
 
97
    existing plot; defaults to \code{FALSE}.}
93
  \item{\dots}{further graphical parameters (\code{\link{par}}) are
98
  \item{\dots}{further graphical parameters (\code{\link{par}}) are
94
    passed to \code{\link{plot.window}()}, \code{\link{title}()} and
99
    passed to \code{\link{plot.window}()}, \code{\link{title}()} and
95
    \code{\link{axis}}.}
100
    \code{\link{axis}}.}
96
}
101
}
97
\details{
102
\details{
Line 119... Line 124...
119
  \code{\link{plot}(\dots, type="h")}, \code{\link{dotchart}},
124
  \code{\link{plot}(\dots, type="h")}, \code{\link{dotchart}},
120
  \code{\link{hist}}.
125
  \code{\link{hist}}.
121
}
126
}
122
\examples{
127
\examples{
123
tN <- table(Ni <- rpois(100, lambda=5))
128
tN <- table(Ni <- rpois(100, lambda=5))
124
r <- barplot(tN, col='gray')
129
r <- barplot(tN, col=rainbow(20))
125
#- type = "h" plotting *is* 'bar'plot
130
#- type = "h" plotting *is* 'bar'plot
126
lines(r, tN, type='h', col='red', lwd=2)
131
lines(r, tN, type='h', col='red', lwd=2)
127
 
132
 
128
barplot(tN, space = 1.5, axisnames=FALSE,
133
barplot(tN, space = 1.5, axisnames=FALSE,
129
        sub = "barplot(..., space= 1.5, axisnames = FALSE)")
134
        sub = "barplot(..., space= 1.5, axisnames = FALSE)")
Line 160... Line 165...
160
title(main = list("Death Rates in Virginia", font = 4))
165
title(main = list("Death Rates in Virginia", font = 4))
161
 
166
 
162
# border :
167
# border :
163
barplot(VADeaths, border = "dark blue") % lwd = 2 << not passed
168
barplot(VADeaths, border = "dark blue") % lwd = 2 << not passed
164
%notyet barplot(VADeaths, inside = FALSE, main = "barplot(*, inside=FALSE)")
169
%notyet barplot(VADeaths, inside = FALSE, main = "barplot(*, inside=FALSE)")
-
 
170
 
-
 
171
# log scales (not much sense here):
-
 
172
barplot(tN, col=heat.colors(12), log = "y")
-
 
173
barplot(tN, col=gray.colors(20), log = "xy")
165
}
174
}
166
\keyword{hplot}
175
\keyword{hplot}