WH.plot_multiple_indivs: Plot the histograms of the individuals on a factorial plane

View source: R/principal_components.R

WH.plot_multiple_indivsR Documentation

Plot the histograms of the individuals on a factorial plane

Description

(Beta version) Plots the histograms (or densities) of one variable for each individual, placed at the coordinates of the individuals on a factorial plane of WH.MultiplePCA.

Usage

WH.plot_multiple_indivs(
  data,
  res,
  axes = c(1, 2),
  indiv = 0,
  var = 1,
  strx = 0.1,
  stry = 1/8,
  HISTO = TRUE,
  coor = 0,
  stat = "mean"
)

Arguments

data

A MatH object, the data of the analysis.

res

The results of WH.MultiplePCA.

axes

A vector of two integers, the factorial axes (default c(1, 2)).

indiv

A vector of integers, the individuals (rows) to plot. Default 0: all the individuals.

var

An integer, the variable to plot.

strx

A number, the average width of the drawn distributions as a fraction of the range of the coordinates of the individuals on the x axis (default 0.1: on average, the domain of a distribution takes one tenth of the x axis). All the distributions share the same scale, so their spreads remain comparable.

stry

A number, the height of the highest density as a fraction of the range of the coordinates of the individuals on the y axis (default 1/8). All the densities share the same scale; spikes (bins of almost zero width) are avoided by drawing histograms with very narrow bins on 30 equal-width bins.

HISTO

A logical value: if TRUE (default) histograms are drawn, otherwise smoothed densities.

coor

A matrix of coordinates of the individuals. Default 0: the coordinates in res.

stat

The statistic used to label and colour the histograms in the second plot: "mean" (default), "std", "skewness" or "kurtosis".

Details

The distributions are measured on the scale of the original variable, while the factorial plane has the scale of the principal components: strx and stry set the size of the drawn distributions automatically, as fractions of the ranges of the coordinates of the individuals. Each distribution is drawn with its mean at the coordinates of the individual.

Value

The two plots are drawn on the current device and a list with the two ggplot objects is returned invisibly.

Examples


results <- WH.MultiplePCA(BLOOD, list.of.vars = c(1:3), graph = FALSE)
WH.plot_multiple_indivs(BLOOD, results, axes = c(1, 2), var = 1, HISTO = TRUE)
WH.plot_multiple_indivs(BLOOD, results, axes = c(1, 2), var = 1, HISTO = FALSE)


HistDAWass documentation built on Oct. 29, 2026, 5:07 p.m.