multiple_pca_plot {hipathia} | R Documentation

## Plots multiple components of a PCA

### Description

Plots multiple components of a PCA analysis computed with `do_pca`

### Usage

    multiple_pca_plot(
      fit,
      group = NULL,
      sample_colors = NULL,
      comps = seq_len(3),
      plot_variance = FALSE,
      legend = TRUE,
      cex = 2,
      pch = 20,
      main = "Multiple PCA plot",
      save_png = NULL
    )

### Arguments

`fit` | princomp object as returned by `do_pca`
`group` | Vector with the group to which each sample belongs. The samples must be ordered as in `path_vals`. By default, all samples will be assigned to the same class.
`sample_colors` | Named character vector of colors. The names of the colors must be the classes in `group`. Each sample will be assigned the color corresponding to its class, taken from the `group` vector. By default a color will be assigned automatically to each class.
`comps` | Vector with the components to be plot
`plot_variance` | Logical, whether to plot the cumulative variance.
`legend` | Boolean, whether to plot a legend in the plot. Default is TRUE.
`cex` | Graphical parameter from `par()` function.
`pch` | Graphical parameter from `par()` function.
`main` | Main title of the image
`save_png` | Path to the file where the image as PNG will be saved. By default, the image is not saved.

### Value

Plots multiple components of a PCA

### Examples

    data(path_vals)
    sample_group <- brca_design[colnames(path_vals),"group"]
    pca_model <- do_pca(path_vals[seq_len(ncol(path_vals)),])
    multiple_pca_plot(pca_model, sample_group, cex = 3, plot_variance = TRUE)

[Package hipathia version 2.2.1 Index]