Skip to contents

Interactive 3D Plot for Multiple Correspondence Analyses (plotly::)

Usage

ggmca_3d(
  res.mca,
  data,
  clust,
  axes = 1:3,
  base_zoom = 1,
  remove_buttons = FALSE,
  cone_size = 0.15,
  view = "All",
  camera_view,
  aspectratio_from_eig = FALSE,
  title,
  ind_name.size = 10,
  max_point_size = 30,
  ...,
  dat,
  cah
)

Arguments

res.mca

An object created with multiple_correspondence_analysis or FactoMineR::MCA.

data

The data frame the analysis was made on, in which to find the clusters.

clust

The variable of `data` holding the clusters, typically made with hierarchical_clust, as a bare name or a string: the answer profiles of one cluster are coloured alike and linked at mouse hover.

axes

The axes to print, as a numeric vector of length 3.

base_zoom

The base level of zoom.

remove_buttons

Set to TRUE to remove buttons to change view.

cone_size

The size of the conic arrow at the end of each axe.

view

The starting point of view (in 3D) :

  • "Plane 1-2" : Axes 1 and 2.

  • "Plane 1-3" : Axes 1 and 3.

  • "Plane 2-3" : Axes 2 and 3.

  • "All" : A 3D perspective with Axes 1, 2, 3.

camera_view

Possibility to add a (replace `view`)

aspectratio_from_eig

Set to `TRUE` to modify axes length based on eigenvalues.

title

The title of the graph.

ind_name.size

The size of the names of individuals.

max_point_size

The size of the biggest point.

...

Additional arguments to pass to ggmca.

dat

Deprecated former name of `data`. Still accepted, with a warning; use `data` instead.

cah

Deprecated former name of `clust`.

Value

A plotly html interactive 3d (or 2d) graph.

Examples

# \donttest{
data(tea, package = "FactoMineR")
res.mca <- multiple_correspondence_analysis(tea, 1:18)
ggmca_3d(res.mca)
# 3D graph with colored clusters tea <- tea |> dplyr::mutate(clust = hierarchical_clust(res.mca, ncp = 3, nb_clust = 6)) ggmca_3d(res.mca, tea, clust = clust)
# }