shist: smooth histogram

Description Usage Arguments Examples

View source: R/shist.R

Description

a smooth histogram with unit indicator (we're simply scaling the kernel density estimate). The advantage of this plot is its interpretability since the height of the curve represents the frequency of a interval of size unit around the point in question. Another advantage is that if z is a matrix, curves are plotted together.

Usage

1
2
shist(z, unit, bw = "nrd0", n, from, to, plotHist = FALSE, add = FALSE,
  xlab, ylab = "Frequency", xlim, ylim, main, ...)

Arguments

z

the data

unit

the unit which determines the y axis scaling and is drawn

bw

arguments to density

n

arguments to density

from

arguments to density

to

arguments to density

plotHist

a logical: should an actual histogram be drawn under curve?

add

a logical: add should the curve be added to existing plot?

xlab

x-axis title, defaults to no title

ylab

y-axis title, defaults to no title

xlim

range of the x-axis

ylim

range of the y-axis

main

an overall title for the plot: see title.

...

arguments to lines

Examples

1
2
3
4
5
set.seed(1)
x = rnorm(50)
par(mfrow=c(2,1))
hist(x, breaks=-5:5)
shist(x, unit=1, xlim=c(-5,5))

rafalab/rafalib documentation built on April 17, 2021, 6:47 p.m.