histrug: Add a histogram rug to a plot

Description Usage Arguments Details Examples

View source: R/histrug.R

Description

histrug places a histgram on the bottom or top axis, to represent the density

Usage

1
histrug(x, height_pct = 10, col = "black", z = NULL, axis = 1)

Arguments

x

A numeric vector. The variable to be summarized by the histogram.

height_pct

A number between (0, 100); default is 10. The tallest bar of the hist will be height_pct of the plot

col

A character string color. Color of the bars.

z

= NULL (default) or numeric scalar. This is height of transformed plot window. The default (NULL) will compute the needed number. This option is used when you want to plot a histogram on both the top and bottom axis. Sharing the same z value ensures that the scale is the same for the top and bottom histograms. (See example.)

axis

Either 1 or 3. Axis on which to draw histogram. 1 - bottom; 3 - top.

Details

Returns invisibly the value of z used in the plot.

Examples

1
2
3
4
5
x <- rnorm(100)
y <- rnorm(100)
plot(x,y)
z <- histrug(x[1:50])
histrug(x[51:100], z = z, axis = 3)

thomasgstewart/tgsify documentation built on June 18, 2020, 11:10 a.m.