Histogram

Share:

Description

plot multiple histograms in one plot

Usage

1
2
3
4
5
histogram.ade(x, group=NULL, w=NULL, data=NULL, vnames=NULL, freq=FALSE,
         breaks="Sturges", density=NULL, angle=NULL, xlab=NULL, ylab=NULL,
         main="", xlim=NULL, ylim=NULL, legendon="topright", xticks=NULL,
         col=NULL, tcol=NULL, bgcol=NULL, lcol=NULL, alpha=NULL, lwd=1,
         kern=TRUE, norm=TRUE, bars=TRUE, wall=0, v=NULL, h=NULL, lty=2)

Arguments

x
  • a numeric vector

  • a string with the name of the variable in the data.frame

  • a formula x~group

group
  • a factor to make separate histogram for each class

  • a string with the name of the group variable in the data.frame

w

weights for weighted histograms

data

a data.frame

vnames

a vector of character strings with the names of groups in the legend

freq

logical: TRUE representation of frequencies or FALSE component density.

breaks

a single number giving the number of cells for the histogram

density

the density of shading lines, in lines per inch. Set it to NA avoid shading lines with wall=0.

angle

the vector of slopes of shading lines, given as an angle in degrees (counter-clockwise).

xlab

a title for the x axis

ylab

a title for the y axis

main

an overall title for the plot

xlim

the x limits (x1, x2) of the plot

ylim

the y limits (y1, y2) of the plot

legendon

a single keyword from:

  • "bottomright"

  • "bottom"

  • "bottomleft"

  • "left"

  • "topleft"

  • "top"

  • "topright"

  • "right"

  • "center"

This places the legend on the inside of the plot frame at the given location.

xticks

the number of ticks on the x axis or a vector of exact ticks

col

colors for each histogram

tcol

color of the text in whole plot

bgcol

the background color for plot dekoration

lcol

color for the lines in plot, a vector of colors is possible, only used if h or v is given

alpha

a parameter in [0, 1] for semi-transparency of histogram

lwd

the line width

kern

logical asking whether to draw lines for kernel density estimation

norm

logical asking whether to draw density from normal distribution for comparison

bars

logical asking whether to draw bars or only polygones of kernel density estimation

wall

a number between 0 and 6 for selection the dekoration style of the plot.

v

the x-value(s) for vertical line(s).

h

the y-value(s) for horizontal line(s).

lty

the line type, a vector of types is possible

Examples

1
2
3
4
g<-rbinom(1000, 1, 0.5)
x<-rnorm(1000)+g
histogram.ade(x, g, wall=3, breaks=24)
histogram.ade(x, g, wall=2, bars=FALSE)