plot_data_scatter {MOFA2} | R Documentation

## Scatterplots of feature values against latent factors

### Description

Function to do a scatterplot of features against factor values.

### Usage

    plot_data_scatter(
      object,
      factor = 1,
      view = 1,
      groups = "all",
      features = 10,
      sign = "all",
      color_by = "group",
      legend = TRUE,
      alpha = 1,
      shape_by = NULL,
      stroke = NULL,
      dot_size = 2.5,
      text_size = NULL,
      add_lm = TRUE,
      lm_per_group = TRUE,
      imputed = FALSE
    )

### Arguments

`object` | a `MOFA` object.
`factor` | string with the factor name, or an integer with the index of the factor.
`view` | string with the view name, or an integer with the index of the view. Default is the first view.
`groups` | groups to plot. Default is "all".
`features` | if an integer (default), the total number of features to plot. If a character vector, a set of manually-defined features.
`sign` | can be 'positive', 'negative' or 'all' (default) to show only positive, negative or all weights, respectively.
`color_by` | specifies groups or values (either discrete or continuous) used to color the dots (samples). This can be either: the string "group": dots are coloured with respect to their predefined groups. a character giving the name of a feature that is present in the input data a character giving the same of a column in the sample metadata slot a vector of the same length as the number of samples specifying the value for each sample. a dataframe with two columns: "sample" and "color"
`legend` | logical indicating whether to add a legend
`alpha` | numeric indicating dot transparency (default is 1).
`shape_by` | specifies groups or values (only discrete) used to shape the dots (samples). This can be either: the string "group": dots are shaped with respect to their predefined groups. a character giving the name of a feature that is present in the input data a character giving the same of a column in the sample metadata slot a vector of the same length as the number of samples specifying the value for each sample. a dataframe with two columns: "sample" and "shape"
`stroke` | numeric indicating the stroke size (the black border around the dots, default is NULL, infered automatically).
`dot_size` | numeric indicating dot size (default is 5).
`text_size` | numeric indicating text size (default is 5).
`add_lm` | logical indicating whether to add a linear regression line for each plot
`lm_per_group` | logical indicating whether to add a linear regression line separately for each group
`imputed` | logical indicating whether to include imputed measurements

### Details

One of the first steps for the annotation of factors is to visualise the weights using `plot_weights` or `plot_top_weights`. However, one might also be interested in visualising the direct relationship between features and factors, rather than looking at "abstract" weights.
A similar function for doing heatmaps rather than scatterplots is `plot_data_heatmap`.

### Value

A `ggplot` object

### Examples

    # Using an existing trained model
    file <- system.file("extdata", "model.hdf5", package = "MOFA2")
    model <- load_model(file)
    plot_data_scatter(model)

[Package MOFA2 version 1.0.1 Index]