plotScatter: Plot scatter of two-dimensional dataset with GMM density.

View source: R/plotScatter.R

plotScatterR Documentation

Plot scatter of two-dimensional dataset with GMM density.

Description

Plot scatter of two-dimensional dataset with density of a Gaussian mixture model.

Usage

plotScatter(Data, CurrGauss, Means, Covariances,
MainAxesAngle, Colors, Cls,Shapes,
ShapeText, AxNames = c("X1", "X2"), ShowAxis = FALSE,
ShowEllipsoids = FALSE, ShowGaussNr = FALSE, Source = "D")

Arguments

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.

Value

plotOut

Plotly object containing plot for direct visualization.

Author(s)

Quirin Stier

Examples

## 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)

Mthrun/AdaptGauss2D documentation built on July 19, 2022, 3:11 a.m.