Skip to contents

Matrix Plot

Usage

plot_matrix(
  object,
  panel,
  diag = TRUE,
  upper = TRUE,
  lower = TRUE,
  freq = FALSE,
  margin = 1,
  scale = TRUE,
  drop_zero = TRUE,
  col = graphics::par("fg"),
  midpoint = NULL,
  axes = TRUE,
  legend = TRUE,
  asp = 1,
  ...
)

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).

panel

A function in the form function(x, y, z, color, ...) which gives the action to be carried out in each panel of the display.

diag

A logical scalar indicating whether the diagonal of the matrix should be plotted. Only used if object is a symmetric matrix.

upper

A logical scalar indicating whether the upper triangle of the matrix should be plotted. Only used if object is a symmetric matrix.

lower

A logical scalar indicating whether the lower triangle of the matrix should be plotted. Only used if object is a symmetric matrix.

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.

scale

A logical scalar indicating whether data should be rescaled to \([-1,1]\). Only used if freq if FALSE.

drop_zero

A logical scalar: should zeros be discarded?

col

A vector of colors.

midpoint

A numeric value specifying the data midpoint.

axes

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

legend

A logical scalar: should a legend be displayed?

asp

A length-one numeric vector, giving the aspect ratio \(y/x\).

...

Further arguments to be passed to panel.