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


plots a density histogram with bins specified by bspec.


plots a density histogram with bin densities computed according to the specification hspec.

Details and Options


open allclose all

Basic Examples  (3)

Plot a density histogram for a dataset:

Include a legend for the bin colors:

Plot the probability density function of the data:

Cumulative distribution function:

Survival function:

Hazard function:

Cumulative hazard function:

Scope  (12)

Data  (8)

Specify the number of bins to use:

Specify a different number of bins to use in x and y:

Specify the bin width:

Specify a different bin width to use in x and y:

Specify bin delimiters:

Specify different bin delimiters to use in x and y:

Specify bin delimiters as an explicit list:

Specify different bin delimiters to use in x and y:

Use different automatic binning methods:

Use different height specifications:

Use a height function that accumulates the bin counts over the y direction:

Nonreal data is taken to be missing:

Presentation  (4)

Add labels:

Color the surface by height:

Style bins:

Use plot theme:

Options  (25)

AspectRatio  (4)

By default, DensityHistogram uses the same width and height:

Specify the height to width ratio:

Use Automatic to determine the ratio from the values:

AspectRatioFull adjusts the height and width to tightly fit inside other constructs:

ChartBaseStyle  (3)

Use ChartBaseStyle to style bins:

ChartBaseStyle combines with ColorFunction:

ColorFunction may override settings for ChartBaseStyle:

ChartElementFunction  (3)

Get a list of built-in settings for ChartElementFunction:

For detailed settings, use Palettes ChartElementSchemes:

Write a custom ChartElementFunction:

ColorFunction  (5)

Color by height:

Named color gradients color in the direction:

Use brightness to correspond to height or density of a function:

Use ColorFunctionScaling->False to get unscaled height values:

Use ColorFunction to combine different style effects:

ColorFunctionScaling  (2)

By default, scaled height values are used:

Use ColorFunctionScaling->False to get unscaled height values:

LabelingFunction  (3)

Use automatic labeling by values through Tooltip and StatusArea:

Do no labeling:

Use Placed to control label placement:

Method  (2)

Show data of each dimension on axes:

Use a box-whisker glyph to show how data distributes in each dimension:

PerformanceGoal  (1)

Generate a bar chart with interactive highlighting:

Emphasize performance by disabling interactive behaviors:

Typically, less memory is required for non-interactive charts:

PlotTheme  (2)

Use simple ticks in a bright color scheme:

Change color scheme:

Applications  (3)

Estimate the density of volcanic craters in western Uganda:

Volcanic crater locations:

A scaling function for labeling:

The estimated density with a scaled legend:

Density histogram for a multivariate time slice of a random process:

Analyze TemporalData by plotting a density histogram for two-dimensional time slices:

Properties & Relations  (4)

DensityHistogram automatically determines bins to use based on data:

DensityHistogram colors the height according to ColorFunction:

Use Histogram3D to visualize data in 3D:

Use SmoothDensityHistogram and SmoothHistogram3D to compare estimated distribution with the data:

Neat Examples  (1)

Wolfram Research (2010), DensityHistogram, Wolfram Language function, (updated 2015).


Wolfram Research (2010), DensityHistogram, Wolfram Language function, (updated 2015).


Wolfram Language. 2010. "DensityHistogram." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2015.


Wolfram Language. (2010). DensityHistogram. Wolfram Language & System Documentation Center. Retrieved from


@misc{reference.wolfram_2023_densityhistogram, author="Wolfram Research", title="{DensityHistogram}", year="2015", howpublished="\url{}", note=[Accessed: 27-February-2024 ]}


@online{reference.wolfram_2023_densityhistogram, organization={Wolfram Research}, title={DensityHistogram}, year={2015}, url={}, note=[Accessed: 27-February-2024 ]}