Skip to contents

Plots a Bertin diagram.

Usage

plot_bertin(object, ...)

# S4 method for matrix
plot_bertin(
  object,
  threshold = NULL,
  freq = FALSE,
  margin = 1,
  col = c("white", "black"),
  flip = TRUE,
  axes = TRUE,
  ...
)

# S4 method for data.frame
plot_bertin(
  object,
  threshold = NULL,
  freq = FALSE,
  margin = 1,
  col = c("white", "black"),
  flip = TRUE,
  axes = TRUE,
  ...
)

Arguments

object

A \(m \times p\) numeric matrix or data.frame of count data (absolute frequencies giving the number of individuals for each category, i.e. a contingency table).

...

Currently not used.

threshold

A function that takes a numeric vector as argument and returns a numeric threshold value (see below). If NULL (the default), no threshold is computed. Only used if freq is FALSE.

freq

A logical scalar indicating whether conditional proportions given margins should be used (i.e. entries of object, divided by the appropriate marginal sums).

margin

An integer vector giving the margins to split by: 1 indicates individuals/rows (the default), 2 indicates variables/columns. Only used if freq is TRUE.

col

A vector of colors.

flip

A logical scalar: should x and y axis be flipped? Defaults to TRUE.

axes

A logical scalar: should axes be drawn on the plot? It will omit labels where they would abut or overlap previously drawn labels.

Value

plot_bertin() is called it for its side-effects: it results in a graphic being displayed (invisibly returns object).

Bertin Matrix

As de Falguerolles et al. (1997) points out: "In abstract terms, a Bertin matrix is a matrix of displays. ... To fix ideas, think of a data matrix, variable by case, with real valued variables. For each variable, draw a bar chart of variable value by case. High-light all bars representing a value above some sample threshold for that variable."

References

Bertin, J. (1977). La graphique et le traitement graphique de l'information. Paris: Flammarion. Nouvelle Bibliothèque Scientifique.

de Falguerolles, A., Friedrich, F. & Sawitzki, G. (1997). A Tribute to J. Bertin's Graphical Data Analysis. In W. Badilla & F. Faulbaum (eds.), SoftStat '97: Advances in Statistical Software 6. Stuttgart: Lucius & Lucius, p. 11-20.

Author

N. Frerebeau

Examples

## Data from Lipo et al. 2015
data("mississippi", package = "folio")

## Plot a Bertin diagram...
## ...without threshold
plot_bertin(mississippi)


## ...with the variable mean as threshold
plot_bertin(mississippi, threshold = mean)


## Plot conditional proportions
plot_bertin(mississippi, freq = TRUE, margin = 1)

plot_bertin(mississippi, freq = TRUE, margin = 2)