bars | R Documentation |
Plotting function alternative to barplot()
.
This function is using polygon()
to plot bars in an existing
plot device. Note that this function is working as a low level plotting
function, thus at least an empty plot should be drawn in advance.
br(x, x0 = 0, at, maxwidth = 0.5, vertical = TRUE, ...)
bars(x, ...)
## Default S3 method:
bars(x, ...)
## S3 method for class 'numeric'
bars(x, x0 = 0, at, maxwidth = 0.5, vertical = TRUE, ...)
x |
Numeric vector with the height of bars. |
x0 |
Numeric vector with the values for the bottom of the bars. |
at |
Numeric vector with the position of bars. |
maxwidth |
Width of bars in plot units. |
vertical |
Logical value indicating whether the bars should be drawn
vertically ( |
... |
Further arguments passed to |
Miguel Alvarez (kamapu78@gmail.com).
data(iris)
## Mean value of petal length by species
iris <- aggregate(Petal.Length ~ Species, iris, mean)
## Plotting steps
plot(NA,
xlim = c(0.5, 3.5), ylim = c(0, max(iris$Petal.Length)), xaxt = "n",
xlab = "Species", ylab = "petal length (cm)", type = "n"
)
axis(side = 1, at = c(1:3), labels = iris$Species)
bars(iris$Petal.Length, at = 1, col = "grey")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.