Learn R Programming

tabula (version 2.0.0)

plot_heatmap: Heatmap

Description

Plots a heatmap.

Usage

plot_heatmap(object, ...)

# S4 method for matrix plot_heatmap(object, diag = TRUE, upper = TRUE, lower = TRUE, freq = FALSE)

# S4 method for data.frame plot_heatmap(object, diag = TRUE, upper = TRUE, lower = TRUE, freq = FALSE)

# S4 method for dist plot_heatmap(object, 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).

...

Currently not used.

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

See Also

Other plot methods: matrigraph(), plot_bertin(), plot_diceleraas(), plot_diversity, plot_ford(), plot_rank(), plot_spot(), seriograph()

Examples

Run this code
data("cantabria")

## Plot matrix diagram...
plot_heatmap(cantabria)
plot_heatmap(cantabria, freq = TRUE)

## Presence/absence data
inc <- sample(0:1, size = 100, replace = TRUE)
bin <- matrix(data = as.logical(inc), nrow = 10, ncol = 10)

plot_heatmap(bin) +
  khroma::scale_fill_logical()

Run the code above in your browser using DataLab