plotFactorScatter {MOFA} | R Documentation

## Scatterplot of two latent factors

### Description

Scatterplot of the values of two latent factors.

### Usage

    plotFactorScatter(object, factors, color_by = NULL, shape_by = NULL,
      name_color = "", name_shape = "", dot_size = 1.5, dot_alpha = 1,
      showMissing = TRUE)

### Arguments

`object` | a trained `MOFAmodel` object.
`factors` | a vector of length two with the factors to plot. Factors can be specified either as a characters using the factor names, or as numeric with the index of the factors
`color_by` | specifies groups or values used to color the samples. This can be either a character giving the name of a feature present in the training data, a character giving the same of a covariate (only if using `MultiAssayExperiment` as input), or a vector of the same length as the number of samples specifying discrete groups or continuous numeric values.
`shape_by` | specifies groups or values used to shape the samples. This can be either a character giving the name of a feature present in the training data, a character giving the same of a covariate (only if using `MultiAssayExperiment` as input), or a vector of the same length as the number of samples specifying discrete groups.
`name_color` | name for color legend.
`name_shape` | name for shape legend.
`dot_size` | dot size (default is 1.5).
`dot_alpha` | dot transparency (default is 1.0, no transparency).
`showMissing` | logical indicating whether to include samples for which `shape_by` or `color_by` is missing.

### Details

One of the first steps for the annotation of factors is to visualise and group/color them using known covariates such as phenotypic or clinical data. This method generates a single scatterplot for the combination of two latent factors. Similar functions are `plotFactorScatters` for doing multiple scatter plots and `plotFactorBeeswarm` for doing Beeswarm plots for single factors.

### Value

Returns a `ggplot2` object

### Examples

    # Example on the CLL data
    filepath <- system.file("extdata", "CLL_model.hdf5", package = "MOFAdata")
    MOFA_CLL <- loadModel(filepath)
    plotFactorScatter(MOFA_CLL, factors=1:2)
    plotFactorScatter(MOFA_CLL, factors=1:2, color_by= "IGHV", shape_by="trisomy12", showMissing=FALSE)

    # Example on the scMT data
    filepath <- system.file("extdata", "scMT_model.hdf5", package = "MOFAdata")
    MOFA_scMT <- loadModel(filepath)
    plotFactorScatter(MOFA_scMT, factors=c(1,3))

[Package MOFA version 1.0.0 Index]