plots a 3D histogram of the values {xi,yi}.


plots a 3D histogram with bins specified by bspec.


plots a 3D histogram with bin heights computed according to the specification hspec.


plots 3D histograms for multiple datasets datai.

Details and Options

  • Histogram3D[data] by default plots a histogram with equal bins chosen to approximate an assumed underlying smooth distribution of the values {xi,yi}.
  • Data elements for Histogram3D can be given in the following forms:
  • {xi,yi}a pure value pair
    {Quantity[xi,unit],Quantity[xi,unit]}value pair with units
  • Data for Histogram3D can be given in the following forms:
  • {e1,e2,}list of elements with or without wrappers
    <|k1e1,k2e2,|>association of keys and elements
    TimeSeries[],EventSeries[],TemporalData[]time series, event series, and temporal data
    WeightedData[],EventData[]augmented datasets
    w[{e1,e2,},]wrapper applied to a whole dataset
    w[{data1,data1,},]wrapper applied to all datasets
  • The width of each bin is computed according to the values xi; the width according to the yi.
  • The following bin specifications bpsec can be given:
  • nuse n bins
    {w}use bins of width w
    {min,max,w}use bins of width w from min to max
    {{b1,b2,}}use bins [b1,b2),[b2,b3),
    Automaticdetermine bin widths automatically
    "name"use a named binning method
    {"Log",bspec}apply binning bspec on log-transformed data
    fbapply fb to get an explicit bin specification {b1,b2,}
    {xspec,yspec}give different x and y specifications
  • The binning specification "Log" is taken to use the Automatic underlying binning method.
  • Possible named binning methods include:
  • "Sturges"compute the number of bins based on the length of data
    "Scott"asymptotically minimize the mean square error
    "FreedmanDiaconis"twice the interquartile range divided by the cube root of sample size
    "Knuth"balance likelihood and prior probability of a piecewise uniform model
    "Wand"one-level recursive approximate Wand binning
  • The function fb in Histogram3D[data,fb] is applied to a list of all {xi,yi}, and should return an explicit bin list {{bx1,bx2,},{by1,by2,}}. In Histogram3D[data,{fx,fy}], fx is applied to the list of xi, and fy to the list of yi.
  • Different forms of 3D histograms can be obtained by giving different bin height specifications hspec in Histogram3D[data,bspec,hspec]. The following forms can be used:
  • "Count"number of elements in each bin
    "CumulativeCount"cumulative counts
    "SurvivalCount"survival counts
    "Probability"fraction of values lying in each bin
    "Intensity"count divided by bin area
    "PDF"probability density function
    "CDF"cumulative distribution function
    "SF"survival function
    "HF"hazard function
    "CHF"cumulative hazard function
    {"Log",hspec}log-transformed height specification
    fhheights obtained by applying fh to bins and counts
  • The function fh in Histogram3D[data,bspec,fh] is applied to three arguments: a list of bins {{bx1,bx2},{bx2,},}, a list of bins {{by1,by2},{by2,},}, and the corresponding 2D array of counts {{c11,c12,},{c21,},}. The function should return an array of heights to be used for each of the cij.
  • Only values {xi,yi} that consist of real numbers are assigned to bins; others are taken to be missing.
  • In Histogram3D[{data1,data2,},], automatic bin locations are determined by combining all the datasets datai.
  • Histogram3D[{,wi[datai,],},] renders the histogram elements associated with dataset datai according to the specification defined by the symbolic wrapper wi.
  • Possible symbolic wrappers are the same as for BarChart3D, and include Style, Labeled, Legended, etc.
  • Histogram3D has the same options as Graphics3D with the following additions and changes:
  • AxesTruewhether to draw axes
    BarOriginBottomorigin of histogram bars
    BoxRatios{1,1,0.4}bounding 3D box ratios
    ChartBaseStyleAutomaticoverall style for bars
    ChartElementFunctionAutomatichow to generate raw graphics for bars
    ChartElementsAutomaticgraphics to use in each of the bars
    ChartLabelsNonecategory labels for datasets
    ChartLayoutAutomaticoverall layout to use
    ChartLegendsNonelegends for data elements and datasets
    ChartStyleAutomaticstyle for bars
    ColorFunctionAutomatichow to color bars
    ColorFunctionScalingTruewhether to normalize arguments to ColorFunction
    LabelingFunctionAutomatichow to label elements
    LegendAppearanceAutomaticoverall appearance of legends
    Lighting"Neutral"simulated light sources to use
    MethodAutomaticmethods to use
    PerformanceGoal$PerformanceGoalaspects of performance to try to optimize
    PlotTheme$PlotThemeoverall theme for the plot
    ScalingFunctionsNonehow to scale individual coordinates
    TargetUnitsAutomaticunits to display in the chart
  • Possible settings for ChartLayout include "Overlapped" and "Stacked".
  • The arguments supplied to ChartElementFunction are the bin region {{xmin,xmax},{ymin,ymax},{zmin,zmax}}, the bin values lists, and metadata {m1,m2,} from each level in a nested list of datasets.
  • A list of built-in settings for ChartElementFunction can be obtained from ChartElementData["Histogram3D"].
  • The argument supplied to ColorFunction is the height for each bin.
  • With ScalingFunctions->{sx,sy,sz}, the coordinate is scaled using sx etc.
  • Style and other specifications from options and other constructs in BarChart are effectively applied in the order ChartStyle, ColorFunction, Style and other wrappers, ChartElements, and ChartElementFunction, with later specifications overriding earlier ones.


open all close all

Basic Examples  (4)

Generate a 3D histogram for a list of pairs:

Click for copyable input

Multiple datasets:

Click for copyable input
Click for copyable input

Generate a probability histogram for a list of values:

Click for copyable input

Use any graphic for pictorial bars:

Click for copyable input

Use procedural bars:

Click for copyable input

Scope  (30)

Options  (43)

Applications  (3)

Properties & Relations  (3)

Neat Examples  (1)

Introduced in 2008
Updated in 2015