intensity_plot: Create Intensity Plot for a Variable in a mass_dataset Object

View source: R/intensity_plot.R

intensity_plotR Documentation

Create Intensity Plot for a Variable in a mass_dataset Object

Description

This function generates an intensity plot for a specific variable in a mass_dataset object. You can specify the variable either by its ID or its index. Additionally, you can customize the color of data points based on a specific attribute and order the samples accordingly.

Usage

intensity_plot(
  object,
  variable_id,
  variable_index,
  color_by,
  order_by,
  desc = FALSE,
  interactive = TRUE
)

Arguments

object

A mass_dataset object.

variable_id

A character string specifying the ID of the variable of interest. If provided, 'variable_index' will be ignored.

variable_index

An integer specifying the index of the variable of interest. If not provided, you can use 'variable_id' to specify the variable by its ID.

color_by

A character string specifying the attribute to color data points. Default is "no", meaning no coloring.

order_by

A character string specifying the attribute to order the samples. Default is "sample_id". If set to "na", no specific order is applied.

desc

A logical value indicating whether to order the samples in descending order. Default is FALSE.

interactive

A logical value indicating whether to create an interactive plot using plotly. Default is TRUE.

Value

A ggplot2 or plotly plot object.

Author(s)

Xiaotao Shen shenxt1990@outlook.com

Examples

data("expression_data")
data("sample_info")
data("sample_info_note")
data("variable_info")
data("variable_info_note")
object =
  create_mass_dataset(
    expression_data = expression_data,
    sample_info = sample_info,
    variable_info = variable_info,
    sample_info_note = sample_info_note,
    variable_info_note = variable_info_note
  )
object

intensity_plot(object = object, variable_index = 1)
intensity_plot(object = object, variable_index = 1, color_by = "class")

tidymass/massdataset documentation built on Jan. 30, 2024, 2:55 p.m.