qplot_prediction.Rd
Plot a 2D scatterplot that represents multidimensionally scaled data.
qplot_prediction(
scores,
Prediction,
Reference,
xLabel = paste("Projection", xproj),
yLabel = paste("Projection", yproj),
Title = "Proximity of Groups",
subTitle = NULL,
palette = hyGet_palette(scores),
type = c("Prediction", "Reference"),
stat = c("chull", "ellipse", "none"),
type.stat = type,
MDS = c("metric", "isoMDS"),
plot.scatter = TRUE,
alpha = 0.5,
k = 2,
xproj = 1,
yproj = 2
)
qplot_proximity(
scores,
by,
xLabel = paste("Projection", xproj),
yLabel = paste("Projection", yproj),
Title = "Proximity of Groups",
subTitle = NULL,
palette = hyGet_palette(scores),
stat = c("chull", "ellipse", "none"),
MDS = c("metric", "isoMDS"),
plot.scatter = TRUE,
alpha = 0.5,
k = 2,
xproj = 1,
yproj = 2
)
Components' amplitudes (scores) as either a matrix or a
hyperSpec
object.
Predicted groups. Either a variable name or a vector.
Reference grpups. Either a variable name or a vector.
A label for abscisa (x) axis.
A label for ordinate (y) axis.
The main title for the plot.
The second line of title, which will be smaller and and in italics.
A color palete to be used. Default is `ggplot2` default palette.
A type of data for scatterplot: either "prediction" (default) or "reference".
A statistic to be added, either "chull" - convex hull (default), "ellipse" or "none"
A type of data for stat
: either "prediction"
(default) or "reference".
A type of Multi-Dimensional Scaling.
Logical. If true
(default), scatterplot
(`geom_point`)is plotted.
Transperency of points.
The desired dimension for the solution, passed to cmdscale
.
An integer: a number of MDS projection to plot on x, y axis (respectively).
A grouping variable
A ggplot
object.
More details in package ggplot2.
Other spHelper plots:
check_palette()
,
layer_spRangeMean()
,
plot_colors()
,
plot_hyPalette()
,
plot_spCompare()
,
plot_spDiff()
,
plot_spDistribution()
,
qplot_confusion()
,
qplot_crosstab()
,
qplot_infoDim()
,
qplot_kAmp()
,
qplot_kSp()
,
qplot_spRangeCenter()
,
qplot_spRangeMedian()
,
qplot_spStat()
,
qplot_spc()
,
rmExpr()
,
rm_stripes()
,
stat_chull()
# Examples with a `hyperSpec` object:
data(Scores2)
Scores2$Prediction <- sample(Scores2$gr)
Scores2 <- hyAdd_color(sp = Scores2, by = "gr", palette = c("tan3", "green4","skyblue"))
qplot_prediction(Scores2,Prediction = "Prediction", Reference = "gr")
qplot_prediction(Scores2,Prediction = "Prediction", Reference = "gr", type = "ref")
qplot_prediction(Scores2,"Prediction","gr", type.stat = "ref", MDS = "isoMDS")
sc <- Scores2[,,c(1,3),wl.index = TRUE]
qplot_prediction(sc,"Prediction","gr", type = "reference")
qplot_prediction(sc,"Prediction","gr", type = "prediction")
qplot_prediction(sc,"Prediction","gr", type = "prediction", type.stat = "ref")
qplot_prediction(sc,"Prediction","gr", type = "prediction", type.stat = "ref",stat ="ellipse")
sc <- Scores2[,,c(1,2),wl.index = TRUE]
sc <- hyAdd_color(sp = sc , by = "class", palette = c("tan3", "green4","skyblue","violet"))
sc$ID <- rownames(sc)
qplot_proximity(sc, "class")
#> Warning: The `<scale>` argument of `guides()` cannot be `FALSE`. Use "none" instead as
#> of ggplot2 3.3.4.
#> ℹ The deprecated feature was likely used in the spHelper package.
#> Please report the issue to the authors.
qplot_proximity(sc, "class", plot.scatter = FALSE) + geom_text(aes(label = sc$ID))