shist: shist

View source: R/plot2.R

shistR Documentation

shist

Description

A stacked histogram with density curve.

Usage

shist(
  x,
  ...,
  col = grey.colors(length(x) + 1L),
  loess = TRUE,
  total = TRUE,
  xlim = NULL,
  ylim = NULL,
  heights = NULL,
  heights.main = 0.5,
  reset_par = TRUE
)

Arguments

x

a list of numeric vectors for which the histogram is desired

...

additional parameters passed to hist or graphical parameters passed to par

col

a vector of colors for each histogram

loess

logical; if TRUE, a loess curve is fit to each histogram

total

logical; if TRUE, an aggregate histogram of x is plotted first, and each element of x is plotted below

xlim, ylim

the x- and y-axis limits (if given, applied to all plots)

heights

an optional vector of values, usually in (0,1), for the heights of each plot on the device; see layout

heights.main

if total = TRUE, the height of the aggregate histogram plot relative to the device, usually in (0,1)

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 length(x) containing the return value of hist for each element of x.

Examples

set.seed(1)
x <- lapply(sample(1:10, 4), rpois, n = 500)

shist(x)
shist(x, heights.main = 0.75)
shist(x, heights = c(5,1,1,1,3))
shist(x, col = terrain.colors(length(x)), total = FALSE,
      ylim = c(0, 200), las = 1L, breaks = 10)


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