Plot a Histogram
Creates a histogram on the current graphics device.
truehist(data, nbins = "Scott", h, x0 = -h/1000, breaks, prob = TRUE, xlim = range(breaks), ymax = max(est), col = "cyan", xlab = deparse(substitute(data)), bty = "n", …)
numeric vector of data for histogram. Missing values (
NAs) are allowed and omitted.
The suggested number of bins. Either a positive integer, or a character string naming a rule:
"FD". (Case is ignored.)
The bin width, a strictly positive number (takes precedence over
Shift for the bins - the breaks are at
x0 + h * (…, -1, 0, 1, …)
The set of breakpoints to be used. (Usually omitted, takes precedence over
If true (the default) plot a true histogram. The vertical axis has a relative frequency density scale, so the product of the dimensions of any panel gives the relative frequency. Hence the total area under the histogram is 1 and it is directly comparable with most other estimates of the probability density function. If false plot the counts in the bins.
The limits for the x-axis.
The upper limit for the y-axis.
The colour for the bar fill: the default is colour 5 in the default R palette.
label for the plot x-axis. By default, this will be the name of
The box type for the plot - defaults to none.
This plots a true histogram, a density estimate of total area 1. If
breaks is specified, those breakpoints are used. Otherwise if
h is specified, a regular grid of bins is used with width
h. If neither
h is specified,
nbins is used to select a suitable
A histogram is plotted on the current device.
Venables, W. N. and Ripley, B. D. (2002) Modern Applied Statistics with S. Fourth edition. Springer.