histGrob: Construct a histogram grob

Description Usage Arguments

View source: R/grob-hist.R

Description

histGrob constructs a histogram of a vector of data. histGrobs inherit the class "hist".

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
histGrob(
  data,
  breaks = 10,
  freq = FALSE,
  include.lowest = TRUE,
  right = TRUE,
  fill = "grey",
  name = NULL,
  gp = NULL,
  vp = NULL,
  max.total.height = NULL
)

Arguments

data

a numeric vector of data.

breaks

if numeric, either an integer specifying the (approximate) number of histogram cells, or a vector specifying the breakpoints between histogram cells. A character string specifies the algorithm used to compute the number of cells (either "Sturges", "Scott" or "Freedman-Diaconis"). Additionally, a function can be supplied to calculate this.

freq

if logical, it indicates whether the histogram should represent frequencies or densities. If 'TRUE', breaks must be equidistant. If this is not the case, 'freq' reverts to FALSE with a warning. If a numeric value, the height of the tallest bar is specified. All other bars are scaled respectively.

include.lowest

a logical value that specifies whether a data value equal to the lowest (or if right = 'TRUE', the highest) break point should be included in the lowest histogram cell.

right

a logical value that indicates whether histogram cells are right closed ('TRUE') or left closed ('FALSE').

fill

a colour to be used to fill the histogram bars. This overrides a fill specified in 'gp'.

name

a name for the grob to be constructed.

gp

graphical parameters for the histogram, constructed with gpar().

vp

a default viewport to be used when drawing the grob. Value: An object of class 'hist' with a list of components. This includes all inputted arguments, although it should be noted that 'freq' defaults to FALSE if break points are not equidistant, and therefore does not necessarily take the value of the supplied argument. In addition, a list 'histvals' is returned, which includes all values that are returned from the generic function 'hist()'. Most importantly: breaks: a vector of break points that split the data into bins. This is useful for specifying the range of the x-axis (see grid.hist.example() below). counts: the frequencies of data points falling into each bin. density: densities for each bin. mids: the cell midpoints. equidist: a logical value indicating whether or not break points are equidistant.


iNZightVIT/vit documentation built on Aug. 3, 2020, 4:11 a.m.