View source: R/principal_components.R
| WH.plot_multiple_indivs | R Documentation |
(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.
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"
)
data |
A |
res |
The results of |
axes |
A vector of two integers, the factorial axes (default
|
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 |
coor |
A matrix of coordinates of the individuals. Default 0: the
coordinates in |
stat |
The statistic used to label and colour the histograms in the
second plot: |
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.
The two plots are drawn on the current device and a list with the two
ggplot objects is returned invisibly.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.