histr: histr

View source: R/plot2.R

histrR Documentation

histr

Description

A histogram with density curve and rug.

Usage

histr(x, ..., lines.pars, rug.pars, poly.pars, reset_par = TRUE)

Arguments

x

a vector of values for which the histogram is desired

...

additional parameters passed to hist or graphical parameters passed to par

lines.pars

optional list of additional parameters passed to line

rug.pars

optional list of additional parameters passed to rug

poly.pars

optional list of additional parameters passed to polygon

reset_par

logical; if TRUE, resets par settings to state before function call; setting reset_par = FALSE is useful for adding to a plot

Value

A list of length two containing the return value of hist and density for x.

Examples

set.seed(1)
histr(x <- rnorm(100), xlim = c(-3, 3), las = 1)
plot(density(x), xlim = c(-3, 3))

histr(
  x + 50, main = 'Age at diagnosis', xlab = 'Age',
  poly.pars = list(col = 'dodgerblue2', density = 30),
  lines.pars = list(lty = 'dashed', lwd = 3),
  rug.pars = list(side = 3, col = 'red')
)


raredd/plotr documentation built on Nov. 19, 2023, 4:09 a.m.