Learn R Programming

Tmisc (version 1.0.1)

Thist: Histograms with overlays

Description

Plot a histogram with either a normal distribution or density curve overlay.

Usage

Thist(x, overlay = "normal", col = "gray80", ...)

Arguments

x

A numeric vector.

overlay

Either "normal" (default) or "density" indicating whether a normal distribution or density curve should be plotted on top of the histogram.

col

Color of the histogram bars.

...

Other arguments to be passed to hist().

Examples

Run this code
set.seed(42)
x <- rnorm(1000, mean=5, sd=2)
Thist(x)
Thist(x, overlay="density")
Thist(x^2)
Thist(x^2, overlay="density", breaks=50, col="lightblue2")

Run the code above in your browser using DataLab