ellipsoid_cluster_plot_3d: Function to plot clusters in 3-dimensions.

View source: R/ellipsoid_cluster_plot_3d.R

ellipsoid_cluster_plot_3dR Documentation

Function to plot clusters in 3-dimensions.

Description

Plot cluster data in 3D by modeling them as an Ellipsoid.

Usage

ellipsoid_cluster_plot_3d(
  niche_data,
  cluster_ids,
  x,
  y,
  z,
  mve = FALSE,
  ellips = TRUE,
  level = 0.975,
  alpha,
  grupos,
  vgrupo,
  cex1 = 0.25
)

Arguments

niche_data

A data.frame or matrix containing niche variables

cluster_ids

Cluster ids

x

variable on x-axes

y

variable on y-axes

z

variable on z-axes

mve

A logical value. If TRUE a minimum volume ellipsoid will be computed using the function cov.rob of the MASS package. If False the covariance matrix of the input data will be used.

ellips

Ellipsoid plot of each cluster

level

proportion of points inside the ellipsoid.

alpha

Transparency level of ellipsoid plots

grupos

Logical. Show ids of a geographic grouping variable

vgrupo

A vector containing the levels of the geographic grouping variable

cex1

Point size

Details

The output of this function is the same of the cov_center function.

Value

Returns a list of the ellipsoid metadata for each cluster.

Examples

## Not run: 
cluster_data <- read.csv(system.file("extdata",
                                     "nichekmeansCluster.csv",
                                      package = "ntbox"))

ellipsoid_clusters <- ellipsoid_cluster_plot_3d(niche_data =environ_data[,c("bio5","bio6","bio12")],
                                                cluster_ids = cluster_data$cluster,
                                                x = "bio5",y="bio6",z="bio12",mve = T,
                                                ellips = T,alpha = 0.25,
                                                grupos = T,vgrupo =cluster_data$cluster,
                                                cex1 = 1,level = 0.975)
# Print metadata for the Minimum Volume Ellipsoid that belongs to cluster 1
print(ellipsoid_clusters$cluster_n_1)

## End(Not run)

luismurao/ntbox documentation built on May 9, 2024, 8:24 p.m.