tracebar: Tracing barplot

View source: R/plot2.R

tracebarR Documentation

Tracing barplot

Description

Draw a barplot with polygons tracing each row.

Usage

tracebar(height, col = NULL, pad = 0.05, alpha = 0.75, ...)

Arguments

height

a matrix of data describing the bars which make up the plot, usually a main/total bar and one or more smaller or subsets of the total; bars are grouped by columns; the first row will be the main bar and other rows will be minor bars

col

colors for each row of height

pad

numeric vector of length one or two controlling the horizontal and vertical padding, respectively

alpha

numeric value in [0,1] for the alpha transparency of polygons

...

additional arguments passed to barplot

Value

A numeric vector with the midpoint of each main bar (i.e., identical to a call to barplot(..., beside = FALSE)).

Additionally, a list attribute (attr(., "coords")) where each list element corresponds to a group of bars. The matrices contain coordinates of each rectangle plus midpoints.

See Also

inbar

Examples

set.seed(1)
tbl <- sapply(1:3, function(x) sort(rpois(3, 10), decreasing = TRUE))
tracebar(tbl)

tracebar(replace(tbl, 5, 0), col = 1:3, space = 0.5)


raredd/plotr documentation built on Nov. 19, 2023, 4:09 a.m.