Plots a heatmap.
Usage
plot_heatmap(object, ...)
# S4 method for class 'matrix'
plot_heatmap(
object,
color = NULL,
diag = TRUE,
upper = TRUE,
lower = TRUE,
freq = FALSE,
margin = 1,
fixed_ratio = TRUE,
axes = TRUE,
legend = TRUE,
...
)
# S4 method for class 'data.frame'
plot_heatmap(
object,
color = NULL,
diag = TRUE,
upper = TRUE,
lower = TRUE,
freq = FALSE,
margin = 1,
fixed_ratio = TRUE,
axes = TRUE,
legend = TRUE,
...
)
# S4 method for class 'dist'
plot_heatmap(
object,
color = NULL,
diag = FALSE,
upper = FALSE,
lower = !upper,
axes = TRUE,
legend = TRUE,
...
)Arguments
- object
A \(m \times p\)
numericmatrixordata.frameof count data (absolute frequencies giving the number of individuals for each category, i.e. a contingency table).- ...
Currently not used.
- color
A vector of colors or a
functionthat when called with a single argument (an integer specifying the number of colors) returns a vector of colors.- diag
A
logicalscalar indicating whether the diagonal of the matrix should be plotted. Only used ifobjectis a symmetric matrix.- upper
A
logicalscalar indicating whether the upper triangle of the matrix should be plotted. Only used ifobjectis a symmetric matrix.- lower
A
logicalscalar indicating whether the lower triangle of the matrix should be plotted. Only used ifobjectis a symmetric matrix.- freq
A
logicalscalar indicating whether conditional proportions givenmarginsshould be used (i.e. entries ofobject, divided by the appropriate marginal sums).- margin
An
integervector giving the margins to split by:1indicates individuals/rows (the default),2indicates variables/columns. Only used iffreqisTRUE.- fixed_ratio
A
logicalscalar: should a fixed aspect ratio (1) be used?- axes
A
logicalscalar: should axes be drawn on the plot? It will omit labels where they would abut or overlap previously drawn labels.- legend
A
logicalscalar: should a legend be displayed?
Value
plot_heatmap() is called for its side-effects: it results in a graphic
being displayed (invisibly returns object).
See also
Other plot methods:
matrigraph(),
plot_bertin(),
plot_diceleraas(),
plot_ford(),
plot_rank(),
plot_spot(),
seriograph()
Examples
## Data from Lipo et al. 2015
data("mississippi", package = "folio")
## Plot raw data
plot_heatmap(mississippi)
## Change colors
plot_heatmap(mississippi, color = color("iridescent"))
## Plot conditional proportions
plot_heatmap(mississippi, freq = TRUE, margin = 1)
plot_heatmap(mississippi, freq = TRUE, margin = 2)
