minbars: Minimal bar plots

View source: R/plot_special.R

minbarsR Documentation

Minimal bar plots

Description

A bar plot.

Usage

minbars(height, unit = NULL, horiz = TRUE, min = 0, ...)

Arguments

height

an integer vector of counts for each bar

unit

the units of height, used to label max(height)

horiz

logical; if TRUE, horizontal bars are drawn

min

bars less than min are not labelled

...

additional arguments passed to barplot

See Also

prettybars; prettybars2; bibar

Examples

set.seed(1)

layout(matrix(c(1, 1, 1, 2:4), 3), widths = c(1, 1.5))
op <- par(las = 1L, mar = c(1, 1, 2, 2))

minbars(table(rbinom(500, 15, 0.5)), unit = 'Billion',
        col = adjustcolor('tomato4', alpha.f = 0.5))
mtext('Group 1', at = par('usr')[1L], adj = 0)
for (ii in 1:3) {
  minbars(table(rbinom(500, 15, 0.5)), unit = 'Million', min = 10,
          horiz = FALSE, col = adjustcolor(ii, alpha.f = 0.5))
  if (ii == 2L)
    abline(h = grconvertY(0:1, 'nfc'), xpd = TRUE)
  text(0, mean(par('usr')[3:4]), paste('Group', ii + 1L),
       xpd = NA, srt = 90, adj = c(0.5, -1), cex = 1.5)
}
par(op)


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