plot_violins: Plot sample/feature violins

View source: R/4_plot.R

plot_violinsR Documentation

Plot sample/feature violins

Description

Plot sample/feature violins

Usage

plot_violins(
  object,
  assay = assayNames(object)[1],
  x,
  fill,
  color = NULL,
  group = NULL,
  facet = NULL,
  nrow = NULL,
  ncol = NULL,
  dir = "h",
  scales = "free",
  labeller = label_value,
  highlight = NULL,
  palette = NULL,
  fixed = list(na.rm = TRUE)
)

plot_feature_violins(
  object,
  assay = assayNames(object)[1],
  x = "feature_id",
  fill = "feature_id",
  color = NULL,
  n = 9,
  facet = NULL,
  nrow = NULL,
  ncol = NULL,
  dir = "h",
  scales = "free",
  labeller = label_value,
  highlight = NULL,
  fixed = list(na.rm = TRUE)
)

plot_sample_violins(
  object,
  assay = assayNames(object)[1],
  x = "sample_id",
  fill = if ("subgroup" %in% svars(object)) "subgroup" else "sample_id",
  color = NULL,
  n = 100,
  facet = NULL,
  nrow = NULL,
  ncol = NULL,
  dir = "h",
  scales = "free",
  labeller = label_value,
  highlight = NULL,
  fixed = list(na.rm = TRUE)
)

plot_subgroup_violins(
  object,
  assay = assayNames(object)[1],
  subgroup,
  x = "subgroup",
  fill = "subgroup",
  color = NULL,
  highlight = NULL,
  facet = "feature_id",
  fixed = list(na.rm = TRUE)
)

Arguments

object

SummarizedExperiment

assay

string

x

svar (string)

fill

svar (string)

color

svar (string)

group

svar (string)

facet

svar (character vector)

nrow

NULL or number

ncol

NULL or number

dir

'h' or 'v' : are facets filled horizontally or vertically ?

scales

'free', 'free_x', 'free_y', or 'fixed'

labeller

label_both or label_value

highlight

fvar expressing which feature should be highlighted (string)

palette

named color vector (character vector)

fixed

fixed aesthetics

n

number

subgroup

subgroup svar

Value

ggplot object

See Also

plot_exprs, plot_densities

Examples

# data
    file <- system.file('extdata/atkin.metabolon.xlsx', package = 'autonomics')
    object <- read_metabolon(file)
    object %<>% extract(, order(.$subgroup))
    control_features <- c('biotin','phosphate')
    fdata(object) %<>% cbind(control = .$feature_name %in% control_features)
# plot
    plot_violins(object[1:12, ], x = 'feature_id', fill = 'feature_id')
    plot_feature_violins(object[1:12, ])
    plot_sample_violins(object[, 1:12],  highlight = 'control')
    plot_subgroup_violins(object[1:4, ], subgroup = 'subgroup')

bhagwataditya/importomics documentation built on Oct. 29, 2024, 3:19 p.m.