LSD (version 4.0-0)

heathist: Color a histogram

Description

A histogram with an additional color stripe based on a kernel density estimate.

Usage

heathist(x, breaks = 20, xlab = NULL, ylab = NULL, main = "heathist",
  colpal = "greys", rev = FALSE, simulate = FALSE, daltonize = FALSE,
  cvd = "p", alpha = NULL, nobox = FALSE, add.density = FALSE,
  col.density = "darkred", add.rug = TRUE, col.rug = "black",
  nrcol = 100, ...)

Arguments

x

a numeric vector.

breaks

a numeric value giving the breaks of the histogram.

xlab

x label, standard graphics parameter.

ylab

y label, standard graphics parameter.

main

title(s) of the plot, standard graphics parameter.

colpal

a character vector containing R built-in color names or a name of a LSD colorpalette as a character string (see disco() or disco) (defaults to "heat", if not specified).

rev

logical: if TRUE (FALSE by default), a reversed colorpalette is used.

simulate

logical: if TRUE (FALSE by default), a converted colorpalette is used to simulate dichromat vision according to http://www.daltonize.org (see daltonize).

daltonize

logical: if TRUE (FALSE by default), a converted colorpalette is used to enhance dichromat vision according to http://www.daltonize.org (see daltonize).

cvd

character string implying the type of color vision deficiency ("p" for protanope, "d" for deuteranope or "t" for tritanope).

alpha

alpha value: a two-digit integer between 01 and 99 for color opacity, i.e. appearance of partial or full transparency (usage omitted by default).

nobox

logical: if TRUE (FALSE by default), the box of the plot is omitted.

add.density

if TRUE (FALSE by default), a density line is added to the histogram.

col.density

a R build-in color for the density line (if add.density = TRUE).

add.rug

if TRUE (FALSE by default), a rug (1-d plot of the data) is added below the histogram-bars.

col.rug

a R build-in color for the rug (if add.rug = TRUE).

nrcol

a non-negative integer specifying the number of colors to be used (defaults to 100, if not specified).

...

additional parameters to be passed to points and plot.

See Also

comparisonplot, demotour, disco, colorpalette

Examples

Run this code
# NOT RUN {
x = rnorm(1000,mean = sample(c(0,3),size = 1000,prob = c(0.4,0.6),replace = TRUE))
heathist(x,xlab="x",add.density=TRUE,col.rug="darkred")

heathist(x,xlab="x",colpal = "matlablike")
# }

Run the code above in your browser using DataCamp Workspace