stackedplot {classmap} | R Documentation |
Make a vertically stacked mosaic plot of class predictions.
Description
Make a vertically stacked mosaic plot of class predictions from the output of
vcr.*.train
or vcr.*.newdata
. Optionally,
the outliers for each class can be shown as a gray rectangle at the top.
Usage
stackedplot(vcrout, cutoff = 0.99, classCols = NULL,
classLabels = NULL, separSize=1, minSize=1.5,
showOutliers = TRUE, showLegend = FALSE, main = NULL,
htitle = NULL, vtitle = NULL)
Arguments
vcrout |
output of |
cutoff |
cases with overall farness |
classCols |
user-specified colors for the classes. If |
classLabels |
names of given labels. If |
separSize |
how much white between rectangles. |
minSize |
rectangles describing less than |
showOutliers |
if |
showLegend |
if |
main |
title for the plot. |
htitle |
title for horizontal axis (given labels). If |
vtitle |
title for vertical axis (predicted labels). If |
Value
A ggplot object.
Author(s)
Raymaekers J., Rousseeuw P.J.
References
Raymaekers J., Rousseeuw P.J., Hubert M. (2021). Class maps for visualizing classification results. Technometrics, appeared online. doi: 10.1080/00401706.2021.1927849(link to open access pdf)
See Also
vcr.da.train
, vcr.da.newdata
,
vcr.knn.train
, vcr.knn.newdata
,
vcr.svm.train
, vcr.svm.newdata
,
vcr.rpart.train
, vcr.rpart.newdata
,
vcr.forest.train
, vcr.forest.newdata
,
vcr.neural.train
, vcr.neural.newdata
Examples
data("data_floralbuds")
X <- data_floralbuds[, 1:6]; y <- data_floralbuds[, 7]
vcrout <- vcr.da.train(X, y)
cols <- c("saddlebrown", "orange", "olivedrab4", "royalblue3")
stackedplot(vcrout, classCols = cols, showLegend = TRUE)
# The legend is not really needed, since we can read the
# color of a class from the bottom of its vertical bar:
stackedplot(vcrout, classCols = cols, main = "Stacked plot of QDA on foral buds data")
# If we do not wish to show outliers:
stackedplot(vcrout, classCols = cols, showOutliers = FALSE)
# For more examples, we refer to the vignettes:
## Not run:
vignette("Discriminant_analysis_examples")
vignette("K_nearest_neighbors_examples")
vignette("Support_vector_machine_examples")
vignette("Rpart_examples")
vignette("Random_forest_examples")
vignette("Neural_net_examples")
## End(Not run)