plotMultipleHistograms: Plot multiple histograms in the same plot

Description Usage Arguments Examples

View source: R/plotMultipleHistograms.R

Description

This function uses the hist function to plot multiple distributions in the same plot

Usage

1

Arguments

distributions

A list containing multiple distributions - each represented as a numeric vector

nBins

The number of bins to be used in the plot. Defaults to 10

colours

A vector of length length(distributions) containing the colour of each distribution plotted

...

Arguments to be passed to plot() function

Examples

1
2
3
4
5
6
7
# Create two random samples from a normal distribution
distributions <- list(rnorm(500, mean=5, sd=0.5), 
                      rnorm(500, mean=8, sd=5), 
                      rnorm(500, mean=20, sd=2))

# Plot overlapping histograms
plotMultipleHistograms(distributions, nBins=20, colours=c(rgb(1,0,0, 0.5), rgb(0,0,1, 0.5), rgb(0,1,0, 0.5)), las=1)

JosephCrispell/plotteR documentation built on June 6, 2021, 7:24 p.m.