Add Text to a Barplot
Places some text directly on the (stacked) bars of a barplot.
BarText(height, b, labels = height, beside = FALSE, horiz = FALSE, ...)
- either a vector or matrix of values describing the bars which make up the plot exactly as used for creating the barplot.
- the returned mid points as returned by
b <- barplot(...).
- the labels to be placed on the bars.
- a logical value. If FALSE, the columns of height are portrayed as stacked bars, and if TRUE the columns are portrayed as juxtaposed bars.
- a logical value. If FALSE, the bars are drawn vertically with the first bar to the left. If TRUE, the bars are drawn horizontally with the first at the bottom.
- the dots are passed to the
It sometimes makes sense to place the results directly on the bars.
b <- barplot(VADeaths) BarText(VADeaths, b=b) b <- barplot(VADeaths, horiz = TRUE) BarText(VADeaths, b=b, horiz = TRUE, col="red", cex=1.5)
Looks like there are no examples yet.