plot_hist: Create a plotly plot from a distribution of values

View source: R/plotting_qc.R

plot_histR Documentation

Create a plotly plot from a distribution of values

Description

This function creates a plotly plot with the distribution of values for each column in the mat matrix, using different colors for each column. The legend will show the column names from mat, and the plot will have the title "Distribution of read counts".

Usage

plot_hist(
  mat,
  title = NULL,
  xlab = "Values",
  ylab = "Frequency",
  show.grid = FALSE
)

Arguments

mat

A matrix with the data to plot.

title

A character scalar for the title of the plot.

xlab

Character scalar for label of the x-axis.

ylab

Character scalar for label of the y-axis.

show.grid

A boolean for whether to show the grid lines.

Value

A plotly plot with the distribution of read counts.

Author(s)

Jared Andrews

Examples

library(CRISPRball)
cts <- read.delim(system.file("extdata", "escneg.count_normalized.txt",
    package = "CRISPRball"
), check.names = FALSE)
cts.log <- as.matrix(log2(cts[, c(-1, -2)] + 1))
colnames(cts.log) <- colnames(cts)[c(-1, -2)]

plot_hist(cts.log,
    title = "Distribution of read counts",
    xlab = "log2(counts + 1)", ylab = "Frequency"
)

j-andrews7/CRISPRball documentation built on Nov. 8, 2024, 2:43 a.m.