plot.rgcca | R Documentation |
Create various plots from a fitted RGCCA object.
## S3 method for class 'rgcca' plot( x, type = "weights", block = seq_along(x$call$blocks), comp = c(1, 2), response = as.factor(rep(1, NROW(x$Y[[1]]))), display_order = TRUE, title = NULL, cex = 1, cex_sub = 12 * cex, cex_main = 14 * cex, cex_lab = 12 * cex, cex_point = 3 * cex, n_mark = 30, sample_colors = NULL, sample_shapes = NULL, var_colors = NULL, var_shapes = NULL, AVE_colors = NULL, show_sample_names = TRUE, show_var_names = TRUE, repel = FALSE, display_blocks = seq_along(x$call$blocks), expand = 1, show_arrows = TRUE, ... )
x |
A fitted RGCCA object (see |
type |
A character string: 'samples', 'weights', 'loadings', 'cor_circle', both', 'ave' (see details). |
block |
A numeric corresponding to the block(s) to plot. |
comp |
A numeric vector indicating the component(s) to consider. |
response |
A vector coloring the points in the "samples" plot. |
display_order |
A logical value for ordering the variables. If TRUE, variables are ordered from highest to lowest absolute value. If FALSE, the block order is used. Default is TRUE. |
title |
A character string giving the title of the plot. |
cex |
A numeric defining the size of the objects in the plot. Default is one. |
cex_sub |
A numeric defining the font size of the subtitle. Default is 12 * cex. |
cex_main |
A numeric defining the font size of the title. Default is 14 * cex. |
cex_lab |
A numeric defining the font size of the labels. Default is 12 * cex. |
cex_point |
A numeric defining the font size of the points. Default is 3 * cex. |
n_mark |
An integer defining the maximum number of bars plotted in the "weights" and "loadings" plots. Default is 30. |
sample_colors |
Colors used to color samples (used in the "samples" and "biplot" plots). |
sample_shapes |
Shapes used for the sample points (used in the "samples" and "biplot" plots). |
var_colors |
Colors used to color variable weights or correlations with canonical components (used in the "weights", "loadings", "cor_circle" and "biplot" plots). |
var_shapes |
Shapes used for the points associated to variable weights or correlations with canonical components (used in the "cor_circle" and "biplot" plots). |
AVE_colors |
Colors used in the AVE plot. |
show_sample_names |
A logical value for showing the sample names in plots "samples" and "biplot". |
show_var_names |
A logical value for showing the variable names in plots "cor_circle" and "biplot". |
repel |
A logical value for repelling text labels from each other. Default is False. |
display_blocks |
A numeric corresponding to the block(s) to display in the correlation_circle. All blocks are displayed by default. |
expand |
A numeric that scales the weights associated to the block variables in the biplot. Default is 1. |
show_arrows |
A logical, if TRUE, arrows are shown in the biplot. Default is FALSE. |
... |
Additional graphical parameters. |
"samples" for sample plot. The blocks (block argument) and components (comp) that will be used on the horizontal and the vertical axes to plot the individuals: (Y[[block[1]]][, comp[1]], Y[[block[2]]][,comp[2]]). Points can be colored according to the response argument.
"weights": barplot of the block weight vectors for one specific block/component. Sorting is applied according to the display_order argument. The number of displayed weights can be set with n_marks.
"loadings": barplot of the block-loading vectors. Sorting is applied according to the display_order argument. The number of displayed weights can be set with n_marks.
"cor_circle" for correlation circle. It represents the correlation between the component corresponding to the first element of the block argument, and the variables of the block corresponding to the blocks specified by the argument display_blocks.
"both": displays both sample plot and correlation circle (implemented only for one block and at least when two components are asked (ncomp >= 2).
"biplot": displays on the same plot the samples and the variables used to compute the components.
"ave": displays the average variance explained for each block.
A ggplot2 plot object.
data(Russett) status <- colnames(Russett)[9:11][apply(Russett[, 9:11], 1, which.max)] X_agric <- as.matrix(Russett[, c("gini", "farm", "rent")]) X_ind <- as.matrix(Russett[, c("gnpr", "labo")]) X_polit <- as.matrix(Russett[, c("demostab", "dictator")]) A <- list(X_agric = X_agric, X_ind = X_ind, X_polit = X_polit) C <- matrix(c(0, 0, 1, 0, 0, 1, 1, 1, 0), 3, 3) fit.rgcca <- rgcca( blocks = A, connection = C, tau = rep(1, 3), ncomp = rep(2, 3) ) ############### # sample plot # ############### # horizontal axis: First component of the first block # vertical axis: First component of the second block plot(fit.rgcca, type = "samples", block = 1:2, comp = 1, response = status) ###################### # all types of plots # ###################### plot(fit.rgcca, type = "loadings") plot(fit.rgcca, type = "weight") plot(fit.rgcca, type = "sample") plot(fit.rgcca, type = "cor_circle") plot(fit.rgcca, type = "biplot") plot(fit.rgcca, type = "ave") # with superblock fit.mcoa <- rgcca( blocks = A, scheme = "factorial", ncomp = rep(2, 4), tau = c(1, 1, 1, 0), superblock = TRUE ) plot(fit.mcoa, type = "both", response = status) plot(fit.mcoa, type = "biplot", response = status)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.