histr: histr

Description Usage Arguments Value Examples

View source: R/plot_misc.R

Description

A histogram with density curve and rug.

Usage

1
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

1
2
3
4
5
6
7
8
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. 13, 2018, 7:05 a.m.