Learn R Programming

tabula (version 1.0.0)

plotMatrix: Matrix plot

Description

Plots a heatmap.

Usage

plotMatrix(object, ...)

# S4 method for CountMatrix plotMatrix(object, PVI = FALSE)

# S4 method for FrequencyMatrix plotMatrix(object, PVI = FALSE)

# S4 method for IncidenceMatrix plotMatrix(object)

Arguments

object

An object to be plotted.

...

Further arguments passed to other methods.

PVI

A logical scalar: should the PVI be drawn instead of frequencies (see details)?

Details

If PVI is FALSE, it plots a heatmap of relative abundances (frequency), otherwise percentages of the independence value are drawn (in french, "pourcentages de valeur d'ind<U+00E9>pendance", PVI).

PVI is calculated for Each cell as the percentage to the column theoretical independence value: PVI greater than \(1\) represent positive deviations from the independance, whereas PVI smaller than \(1\) represent negative deviations (Desachy 2004).

The PVI matrix allows to explore deviations from independence (an intuitive graphical approach to \(\chi^2\)), in such a way that a high-contrast matrix has quite significant deviations, with a low risk of being due to randomness (Desachy 2004).

References

Desachy, B. (2004). Le s<U+00E9>riographe EPPM: un outil informatis<U+00E9> de s<U+00E9>riation graphique pour tableaux de comptages. Revue arch<U+00E9>ologique de Picardie, 3(1), 39-56. DOI: 10.3406/pica.2004.2396.

See Also

Other plot: plotBar, plotRank, plotSpot

Examples

Run this code
# NOT RUN {
# Abundance data
## Coerce dataset to abundance matrix
## Data from Desachy 2004
count <- as(compiegne, "CountMatrix")

# Plot matrix diagram...
## ...without threshod (i.e. heatmap)
plotMatrix(count)

## ...with PVI as threshold (i.e. Bruno Desachy's matrigraphe)
plotMatrix(count, PVI = TRUE) +
  ggplot2::scale_fill_gradient2(midpoint = 1)

# Presence/absence data
bin <- IncidenceMatrix(data = sample(0:1, size = 100, replace = TRUE),
                       nrow = 10, ncol = 10)

# Plot matrix diagram
plotMatrix(bin) +
  ggplot2::scale_fill_manual(values = c("TRUE" = "black", "FALSE" = "white"))
# }

Run the code above in your browser using DataLab