plot.biodata: Distribution plot

View source: R/plot_utils.R

plot.biodataR Documentation

Distribution plot

Description

Distribution plot of cell subtypes according to the expression level (high or low) of a selected gene.

Usage

## S3 method for class 'biodata'
plot(
  x,
  type = "violin",
  dots = FALSE,
  title = NULL,
  xlab = NULL,
  ylab = NULL,
  stats = NULL,
  draw = TRUE,
  axis.text.x = element_text(size = 10),
  axis.text.y = element_text(size = 8),
  cex.lab = 12,
  cex.main = 16,
  col = (scales::hue_pal())(length(unique(x$cell_type))),
  axis.title.x = element_text(size = cex.lab, face = "bold.italic", vjust = -0.5),
  axis.title.y = element_text(size = cex.lab, face = "bold.italic", vjust = -0.5),
  plot.title = element_text(size = cex.main, face = "bold", vjust = 1, hjust = 0.5),
  plot.margin = unit(c(0, 0, 0, -0.5), "cm"),
  ...
)

Arguments

x

object from convert2biodata() for a dataframe containing columns named high (logical), cell_type (factor) and value (float).

type

character for the type of plot to be chosen among "violin" or "boxplot".

dots

boolean to add all points to the graph.

title

character for the title of the plot.

xlab

character for the name of the X axis label.

ylab

character for the name of the Y axis label.

stats

object from calculate_pvalue().

draw

bolean to plot the graph.

axis.text.x

tick labels along axes (element_text()). Specify all axis tick labels (axis.text), tick labels by plane (using axis.text.x or axis.text.y), or individually for each axis (using axis.text.x.bottom, axis.text.x.top, axis.text.y.left, axis.text.y.right). ⁠axis.text.*.*⁠ inherits from ⁠axis.text.*⁠ which inherits from axis.text, which in turn inherits from text

axis.text.y

tick labels along axes (element_text()). Specify all axis tick labels (axis.text), tick labels by plane (using axis.text.x or axis.text.y), or individually for each axis (using axis.text.x.bottom, axis.text.x.top, axis.text.y.left, axis.text.y.right). ⁠axis.text.*.*⁠ inherits from ⁠axis.text.*⁠ which inherits from axis.text, which in turn inherits from text

cex.lab

numerical value giving the amount by which x and y plotting labels should be magnified relative to the default.

cex.main

numerical value giving the amount by which main plotting title should be magnified relative to the default.

col

character for the specification for the default plotting color. See section 'Color Specification' in graphics::par().

axis.title.x

labels of axes (element_text()). Specify all axes' labels (axis.title), labels by plane (using axis.title.x or axis.title.y), or individually for each axis (using axis.title.x.bottom, axis.title.x.top, axis.title.y.left, axis.title.y.right). ⁠axis.title.*.*⁠ inherits from ⁠axis.title.*⁠ which inherits from axis.title, which in turn inherits from text

axis.title.y

labels of axes (element_text()). Specify all axes' labels (axis.title), labels by plane (using axis.title.x or axis.title.y), or individually for each axis (using axis.title.x.bottom, axis.title.x.top, axis.title.y.left, axis.title.y.right). ⁠axis.title.*.*⁠ inherits from ⁠axis.title.*⁠ which inherits from axis.title, which in turn inherits from text

plot.title

plot title (text appearance) (element_text(); inherits from title) left-aligned by default

plot.margin

margin around entire plot (unit with the sizes of the top, right, bottom, and left margins)

...

arguments to pass to ggplot2::theme().

Value

No return value, called for side effects

Examples

library("ggplot2")
data(tcga)
(df <- convert2biodata(
    algorithm = "Cibersort_ABS",
    disease = "breast invasive carcinoma",
    tissue = "Primary Tumor",
    gene_x = "ICOS"
))

plot(df)
stats <- calculate_pvalue(df)
plot(
    df,
    stats = stats,
    type = "boxplot",
    dots = TRUE,
    xlab = "Expression level of the 'ICOS' gene by cell type",
    ylab = "Percent of relative abundance\n(from the Cibersort_ABS algorithm)",
    title = "Differential analysis of tumor tissue immune cell type abundance
    based on RNASeq gene-level expression from The Cancer Genome Atlas
    (TCGA) database",
    axis.text.y = element_text(size = 8, hjust = 0.5),
    plot.title =  element_text(face = "bold", hjust = 0.5)
)


tcgaViz documentation built on April 4, 2023, 5:14 p.m.