Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

plotMultiHist

Plot multiple histograms in a single plot


Description

This function plots density or cumulative distribution function of multiple histograms in a single plot, using lines.

Usage

plotMultiHist(
   data, 
   nBreaks = 100, 
   col = 1:length(data), 
   scaleBy = c("area", "max", "none"), 
   cumulative = FALSE, 
   ...)

Arguments

data

A list in which each component corresponds to a separate histogram and is a vector of values to be shown in each histogram.

nBreaks

Number of breaks in the combined plot.

col

Color of the lines. Should be a vector of the same length as data.

scaleBy

Method to make the different histograms comparable. The counts are scaled such that either the total area or the maximum are the same for all histograms, or the histograms are shown without scaling.

cumulative

Logical: should the cumulative distribution be shown instead of the density?

...

Other graphical arguments.

Value

Invisibly,

x

A list with one component per histogram (component of data), giving the bin midpoints

y

A list with one component per histogram (component of data), giving the scaled bin counts

Note

This function is still experimental and behavior may change in the future.

Author(s)

Peter Langfelder

See Also

Examples

data = list(rnorm(1000), rnorm(10000) + 2);
plotMultiHist(data, xlab = "value", ylab = "scaled density")

WGCNA

Weighted Correlation Network Analysis

v1.70-3
GPL (>= 2)
Authors
Peter Langfelder <Peter.Langfelder@gmail.com> and Steve Horvath <SHorvath@mednet.ucla.edu> with contributions by Chaochao Cai, Jun Dong, Jeremy Miller, Lin Song, Andy Yip, and Bin Zhang
Initial release
2021-02-17

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.