gghist: Histogram with optional normal density functions

Description Usage Arguments Value Author(s) Examples

View source: R/autoplot.R

Description

Plots a histogram and density estimates using ggplot.

Usage

1
gghist(y, title = NULL, xlab = NULL, ylab = "counts", bins, add.normal = TRUE)

Arguments

y

a numeric vector or an object of the ts class containing a stationary time series.

title

a string with the plot's title.

xlab

a string with the plot's x axis label. By default a NUll value

ylab

a string with the plot's y axis label. By default a "counts" value

bins

The number of bins to use for the histogram. Selected by default using the Friedman-Diaconis rule.

add.normal

A boolean value. Add a normal density function for comparison, by default add.normal = TRUE.

Value

None. Function produces a ggplot2 graph.

Author(s)

Rob J Hyndman

Examples

1
2
x = rnorm(100)
gghist(x,add.normal = TRUE)

bayesforecast documentation built on June 17, 2021, 5:14 p.m.