Learn R Programming

Momocs (version 1.1.6)

plot_CV: Plots a cross-validation table as an heatmap

Description

Either with frequencies (or percentages) plus marginal sums, and values as heatmaps. Used in Momocs for plotting cross-validation tables but may be used for any table (likely with freq=FALSE).

Usage

plot_CV(x, ...)

# S3 method for default plot_CV(x, freq = FALSE, rm0 = TRUE, cex = 5, round = 2, labels = TRUE, ...)

# S3 method for LDA plot_CV(x, freq = FALSE, rm0 = TRUE, cex = 5, round = 2, labels = TRUE, ...)

Arguments

x
a (cross-validation table) or an LDA object
...
only used for the generic
freq
logical whether to display frequencies or counts
rm0
logical whether to remove zeros
cex
numeric to adjust labels in every cell. NA to remove them
round
numeric, when freq=TRUE how many decimals should we display
labels
logical whether to display freq or counts as text labels

Value

a ggplot object

See Also

LDA, plot.LDA, and (pretty much the same) Ntable.

Examples

Run this code
data(olea)
ol <- LDA(PCA(opoly(olea, 5)), "domes")
# freq=FALSE inspired by Chitwood et al. New Phytol fig. 4
gg <- plot_CV(ol, freq=FALSE)
gg

# and you can tune the gg object wit regular ggplot2 syntax eg
gg + ggplot2::scale_color_discrete(h = c(120, 240))

# freq=TRUE
plot_CV(ol, freq=TRUE)

Run the code above in your browser using DataLab