density_plot: Density Plot

View source: R/batch_detection.R

density_plotR Documentation

Density Plot

Description

This function draws an overlap of multiple density plots for each batch.

Usage

density_plot(
    df,
    title = NULL,
    batch.legend.title = "Batch",
    xlab = "Value",
    color.set = NULL,
    title.hjust = 0.5
)

Arguments

df

A data frame used to draw the density plots.

title

Character, the plot title.

batch.legend.title

Character, the legend title of batches.

xlab

Character, x-axis title.

color.set

A vector of character, indicating the set of colors to use. The colors are represented by hexadecimal color code.

title.hjust

Numeric, horizontal justification of the plot title, in the range of 0 to 1.

Value

None.

Author(s)

Yiwen Wang, Kim-Anh LĂȘ Cao

See Also

Scatter_Density, box_plot, alignment_score and partVar_plot as the other methods for batch effect detection and batch effect removal assessment.

Examples

# The first example
library(TreeSummarizedExperiment) # for functions assays(),rowData()
data('AD_data')
# centered log ratio transformed data
ad.clr <- assays(AD_data$EgData)$Clr_value
ad.batch <- rowData(AD_data$EgData)$Y.bat # batch information
names(ad.batch) <- rownames(AD_data$EgData)
ad.df <- data.frame(value = ad.clr[,1], batch = ad.batch)
density_plot(df = ad.df, title = 'OTU 12')

# The second example
colorlist <- rainbow(10)
density_plot(df = ad.df, title = 'OTU 12', color.set = colorlist)


EvaYiwenWang/PLSDAbatch documentation built on Sept. 25, 2024, 8:54 p.m.