Learn R Programming

Momocs (version 1.1.6)

Ntable: Plots confusion matrix of sample sizes within $fac

Description

An utility that plots a confusion matrix of sample size (or a barplot) for every object with a $fac. Useful to visually how large are sample sizes, how (un)balanced are designs, etc.

Usage

Ntable(x, fac1, fac2 = fac1, rm0 = FALSE)

Arguments

x
any object with a $fac slot (Coo, Coe, PCA, etc.)
fac1
the name or id of the first factor
fac2
the name of id of the second factor
rm0
logical whether to print zeros

Value

a ggplot2 object

See Also

Other plotting functions: conf_ell, coo_arrows, coo_draw, coo_listpanel, coo_lolli, coo_plot, coo_ruban, ldk_chull, ldk_confell, ldk_contour, ldk_labels, ldk_links, plot_devsegments

Examples

Run this code
data(olea)
Ntable(olea, "var")
Ntable(olea, "domes", "var")
gg <- Ntable(olea, "domes", "var", rm0 = TRUE)
gg
library(ggplot2)
gg + coord_equal()
gg + scale_fill_gradient(low="green", high = "red")
gg + coord_flip()

Run the code above in your browser using DataLab