Learn R Programming

tabula (version 1.8.0)

plot_spot: Spot Plot

Description

Plots a spot matrix.

Usage

plot_spot(object, ...)

# S4 method for matrix plot_spot( object, type = c("ring", "plain"), threshold = NULL, diag = TRUE, upper = TRUE, lower = TRUE, freq = FALSE, ... )

# S4 method for data.frame plot_spot( object, type = c("ring", "plain"), threshold = NULL, diag = TRUE, upper = TRUE, lower = TRUE, freq = FALSE, ... )

# S4 method for dist plot_spot( object, type = c("ring", "plain"), diag = FALSE, upper = FALSE, lower = !upper, ... )

Value

A ggplot2::ggplot object.

Arguments

object

A \(m \times p\) numeric matrix or data.frame of count data (absolute frequencies giving the number of individuals for each class).

...

Extra parameters to be passed to threshold.

type

A character string specifying the graph to be plotted. It must be one of "ring" (the default) or "plain". Any unambiguous substring can be given.

threshold

A function that takes a numeric vector as argument and returns a numeric threshold value. If NULL (the default), no threshold is computed.

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 relative frequency should be used instead of counts (absolute frequency).

Author

N. Frerebeau

Details

The spot matrix can be considered as a variant of the Bertin diagram where the data are first transformed to relative frequencies.

See Also

Other plot methods: plot_bar, plot_diversity, plot_heatmap(), plot_line

Examples

Run this code
data("cantabria")

## Plot spot diagram of count data...
### ...without threshod
plot_spot(cantabria)
### ...with the  column means as threshold
plot_spot(cantabria, threshold = mean)
### ...with the column medians as threshold
plot_spot(cantabria, threshold = median)

Run the code above in your browser using DataLab