plotScatter | R Documentation |
Plot scatter of two-dimensional dataset with density of a Gaussian mixture model.
plotScatter(Data, CurrGauss, Means, Covariances, MainAxesAngle, Colors, Cls,Shapes, ShapeText, AxNames = c("X1", "X2"), ShowAxis = FALSE, ShowEllipsoids = FALSE, ShowGaussNr = FALSE, Source = "D")
Data |
[1:n, 1:2] Numeric matrix with n observations and 2 features. |
CurrGauss |
Integer indicating the currently selected Gaussian component. |
Means |
List with l [1:2] numerical vector defining the means of the l GMM components. |
Covariances |
List with l [1:2, 1:2] numerical matrices defining the covariance matrices of the l GMM components. |
MainAxesAngle |
List of numeric vectors with 1st and 2nd main axes of a 2D ellipsoid and the respective angles measured to the first unit vector c(0,1). |
Colors |
[1:l] Character vector with l color names or more. |
Cls |
[1:n] Numerical vector of size n containing the classes of each observation. |
Shapes |
List of List with 4 attributes (type, fillcolor, opacity, path) for a shape for plotting. Here it is used for plotting an ellipsoid. |
ShapeText |
[1:l, 1:3] Numeric matrix with l means and two entries for the two-dimensional coordinates and one entry for the number of the Gaussian component. |
AxNames |
[1:2] Character vector with ax names for plot description. |
ShowAxis |
Boolean indicating to show models axis or not. |
ShowEllipsoids |
Boolean indicating to show models ellipsoids or not. |
ShowGaussNr |
Boolean indicating to enumerate model components. |
Source |
Character indicating plot source. Important attribute for plotly in shiny in order to keep control of specific panels. |
plotOut |
Plotly object containing plot for direct visualization. |
Quirin Stier
## Not run: data(EngyTime) Data = EngyTime densityMap = MASS::kde2d(Data[,1], Data[,2], n = 100) z = sapply(1:nrow(Data), function(i){ densityMap$z[ which.min(abs(densityMap$x - Data[i,1])), which.min(abs(densityMap$y - Data[i,2])) ] }) dataDensity = z Cls = rep(1, nrow(Data)) DataSample = sample(1:nrow(Data), min(nrow(Data), 5000)) Colors = c("red", "blue") Plot_3D_DataDensity(Data, DataSample, Colors, Cls, densityMap, dataDensity, Show3DPoints = T, Source = "F1") ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.