Skip to main content

Histogram

A histogram.

Options

  • data | object (required): object of value arrays. Default: none.
  • variable | string (required): variable to display. Default: none.
  • group | (string|Factor): grouping variable. Default: none.
  • title | string: title of histogram. Default: none.
  • groupMode | string: whether to overlay grouped histograms on top of each other (Overlay) or in separate plots next to each other (Facets). Default: 'Overlay'.
  • displayDensity | boolean: controls whether to display density values instead of counts on the y-axis. Default: false.
  • densityType | (string|array<string>): when displaying densities, one can either overlay parametric distribution(s) (Normal, Uniform, T, 'Chi-squared, or Exponential) and/or a non-parametric kernel density estimate (Data-driven). Default: none`.
  • densityParams | (array<number>|any): distribution parameters for the density when a parametric distribution is used ([mu, sigma] for a normal distribution, [a, b] for a uniform distribution, [lambda] for an exponential distribution) or an object mapping distribution names to parameters when multiple densities should be displayed (e.g., {'Normal': [mu, sigma], 'Uniform': [a, b]}, 'Exponential': [lambda]}). Default: [].
  • bandwidthAdjust | number: manual adjustment of bandwidth of kernel density (applicable only when densityType is set to Data-driven). Default: 1.
  • binStrategy | string: binning strategy (Automatic, Select # of bins, or Set bin width). Default: 'Automatic'.
  • nBins | number: custom number of bins. Default: none.
  • nCols | number: number of columns when displaying a facetted grouped histogram. Default: none.
  • xBins | {start,size,end}: object with start, size, and end properties governing binning behavior. Default: {}.
  • sameXRange | boolean: if true, the x-axis range for each facet will be the same as the overall histogram. Default: false.
  • sameYRange | boolean: if true, the y-axis range for each facet will be the same as the overall histogram. Default: false.

Examples

Live Editor
Result
ReferenceError: Provider is not defined