Products
  • Wolfram|One

    The definitive Wolfram Language and notebook experience

  • Mathematica

    The original technical computing environment

  • Wolfram Notebook Assistant + LLM Kit

    All-in-one AI assistance for your Wolfram experience

  • System Modeler
  • Wolfram Player
  • Finance Platform
  • Wolfram Engine
  • Enterprise Private Cloud
  • Application Server
  • Wolfram|Alpha Notebook Edition
  • Wolfram Cloud App
  • Wolfram Player App

More mobile apps

Core Technologies of Wolfram Products

  • Wolfram Language
  • Computable Data
  • Wolfram Notebooks
  • AI & Linguistic Understanding

Deployment Options

  • Wolfram Cloud
  • wolframscript
  • Wolfram Engine Community Edition
  • Wolfram LLM API
  • WSTPServer
  • Wolfram|Alpha APIs

From the Community

  • Function Repository
  • Community Paclet Repository
  • Example Repository
  • Neural Net Repository
  • Prompt Repository
  • Wolfram Demonstrations
  • Data Repository
  • Group & Organizational Licensing
  • All Products
Consulting & Solutions

We deliver solutions for the AI era—combining symbolic computation, data-driven insights and deep technical expertise

  • Data & Computational Intelligence
  • Model-Based Design
  • Algorithm Development
  • Wolfram|Alpha for Business
  • Blockchain Technology
  • Education Technology
  • Quantum Computation

WolframConsulting.com

Wolfram Solutions

  • Data Science
  • Artificial Intelligence
  • Biosciences
  • Healthcare Intelligence
  • Sustainable Energy
  • Control Systems
  • Enterprise Wolfram|Alpha
  • Blockchain Labs

More Wolfram Solutions

Wolfram Solutions For Education

  • Research Universities
  • Colleges & Teaching Universities
  • Junior & Community Colleges
  • High Schools
  • Educational Technology
  • Computer-Based Math

More Solutions for Education

  • Contact Us
Learning & Support

Get Started

  • Wolfram Language Introduction
  • Fast Intro for Programmers
  • Fast Intro for Math Students
  • Wolfram Language Documentation

More Learning

  • Highlighted Core Areas
  • Demonstrations
  • YouTube
  • Daily Study Groups
  • Wolfram Schools and Programs
  • Books

Grow Your Skills

  • Wolfram U

    Courses in computing, science, life and more

  • Community

    Learn, solve problems and share ideas.

  • Blog

    News, views and insights from Wolfram

  • Resources for

    Software Developers

Tech Support

  • Contact Us
  • Support FAQs
  • Support FAQs
  • Contact Us
Company
  • About Wolfram
  • Career Center
  • All Sites & Resources
  • Connect & Follow
  • Contact Us

Work with Us

  • Student Ambassador Initiative
  • Wolfram for Startups
  • Student Opportunities
  • Jobs Using Wolfram Language

Educational Programs for Adults

  • Summer School
  • Winter School

Educational Programs for Youth

  • Middle School Camp
  • High School Research Program
  • Computational Adventures

Read

  • Stephen Wolfram's Writings
  • Wolfram Blog
  • Wolfram Tech | Books
  • Wolfram Media
  • Complex Systems

Educational Resources

  • Wolfram MathWorld
  • Wolfram in STEM/STEAM
  • Wolfram Challenges
  • Wolfram Problem Generator

Wolfram Initiatives

  • Wolfram Science
  • Wolfram Foundation
  • History of Mathematics Project

Events

  • Stephen Wolfram Livestreams
  • Online & In-Person Events
  • Contact Us
  • Connect & Follow
Wolfram|Alpha
  • Your Account
  • User Portal
  • Wolfram Cloud
  • Products
    • Wolfram|One
    • Mathematica
    • Wolfram Notebook Assistant + LLM Kit
    • System Modeler
    • Wolfram Player
    • Finance Platform
    • Wolfram|Alpha Notebook Edition
    • Wolfram Engine
    • Enterprise Private Cloud
    • Application Server
    • Wolfram Cloud App
    • Wolfram Player App

    More mobile apps

    • Core Technologies
      • Wolfram Language
      • Computable Data
      • Wolfram Notebooks
      • AI & Linguistic Understanding
    • Deployment Options
      • Wolfram Cloud
      • wolframscript
      • Wolfram Engine Community Edition
      • Wolfram LLM API
      • WSTPServer
      • Wolfram|Alpha APIs
    • From the Community
      • Function Repository
      • Community Paclet Repository
      • Example Repository
      • Neural Net Repository
      • Prompt Repository
      • Wolfram Demonstrations
      • Data Repository
    • Group & Organizational Licensing
    • All Products
  • Consulting & Solutions

    We deliver solutions for the AI era—combining symbolic computation, data-driven insights and deep technical expertise

    WolframConsulting.com

    Wolfram Solutions

    • Data Science
    • Artificial Intelligence
    • Biosciences
    • Healthcare Intelligence
    • Sustainable Energy
    • Control Systems
    • Enterprise Wolfram|Alpha
    • Blockchain Labs

    More Wolfram Solutions

    Wolfram Solutions For Education

    • Research Universities
    • Colleges & Teaching Universities
    • Junior & Community Colleges
    • High Schools
    • Educational Technology
    • Computer-Based Math

    More Solutions for Education

    • Contact Us
  • Learning & Support

    Get Started

    • Wolfram Language Introduction
    • Fast Intro for Programmers
    • Fast Intro for Math Students
    • Wolfram Language Documentation

    Grow Your Skills

    • Wolfram U

      Courses in computing, science, life and more

    • Community

      Learn, solve problems and share ideas.

    • Blog

      News, views and insights from Wolfram

    • Resources for

      Software Developers
    • Tech Support
      • Contact Us
      • Support FAQs
    • More Learning
      • Highlighted Core Areas
      • Demonstrations
      • YouTube
      • Daily Study Groups
      • Wolfram Schools and Programs
      • Books
    • Support FAQs
    • Contact Us
  • Company
    • About Wolfram
    • Career Center
    • All Sites & Resources
    • Connect & Follow
    • Contact Us

    Work with Us

    • Student Ambassador Initiative
    • Wolfram for Startups
    • Student Opportunities
    • Jobs Using Wolfram Language

    Educational Programs for Adults

    • Summer School
    • Winter School

    Educational Programs for Youth

    • Middle School Camp
    • High School Research Program
    • Computational Adventures

    Read

    • Stephen Wolfram's Writings
    • Wolfram Blog
    • Wolfram Tech | Books
    • Wolfram Media
    • Complex Systems
    • Educational Resources
      • Wolfram MathWorld
      • Wolfram in STEM/STEAM
      • Wolfram Challenges
      • Wolfram Problem Generator
    • Wolfram Initiatives
      • Wolfram Science
      • Wolfram Foundation
      • History of Mathematics Project
    • Events
      • Stephen Wolfram Livestreams
      • Online & In-Person Events
    • Contact Us
    • Connect & Follow
  • Wolfram|Alpha
  • Wolfram Cloud
  • Your Account
  • User Portal
Wolfram Language & System Documentation Center
DensityHistogram
  • See Also
    • Histogram3D
    • Histogram
    • SmoothDensityHistogram
    • SmoothHistogram3D
    • SmoothHistogram
    • HistogramList
    • HistogramDistribution
    • ArrayPlot
    • MatrixPlot
    • GeoHistogram
    • GeoSmoothHistogram
  • Related Guides
    • Statistical Visualization
    • Random Variables
    • Spatial Point Collections
    • Tabular Visualization
    • See Also
      • Histogram3D
      • Histogram
      • SmoothDensityHistogram
      • SmoothHistogram3D
      • SmoothHistogram
      • HistogramList
      • HistogramDistribution
      • ArrayPlot
      • MatrixPlot
      • GeoHistogram
      • GeoSmoothHistogram
    • Related Guides
      • Statistical Visualization
      • Random Variables
      • Spatial Point Collections
      • Tabular Visualization

DensityHistogram[{{x1,y1},{x2,y2},…}]

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

DensityHistogram[{{x1,y1},{x2,y2},…},bspec]

plots a density histogram with bins specified by bspec.

DensityHistogram[{{x1,y1},{x2,y2},…},bspec,hspec]

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

Details and Options
Details and Options Details and Options
Examples  
Basic Examples  
Scope  
Data  
Tabular Data  
Presentation  
Options  
AspectRatio  
Axes  
AxesLabel  
Show More Show More
AxesOrigin  
AxesStyle  
ChartBaseStyle  
ChartElementFunction  
ColorFunction  
ColorFunctionScaling  
ImageSize  
LabelingFunction  
Method  
PerformanceGoal  
PlotInteractivity  
PlotTheme  
Ticks  
TicksStyle  
Applications  
Properties & Relations  
Neat Examples  
See Also
Related Guides
History
Cite this Page
BUILT-IN SYMBOL
  • See Also
    • Histogram3D
    • Histogram
    • SmoothDensityHistogram
    • SmoothHistogram3D
    • SmoothHistogram
    • HistogramList
    • HistogramDistribution
    • ArrayPlot
    • MatrixPlot
    • GeoHistogram
    • GeoSmoothHistogram
  • Related Guides
    • Statistical Visualization
    • Random Variables
    • Spatial Point Collections
    • Tabular Visualization
    • See Also
      • Histogram3D
      • Histogram
      • SmoothDensityHistogram
      • SmoothHistogram3D
      • SmoothHistogram
      • HistogramList
      • HistogramDistribution
      • ArrayPlot
      • MatrixPlot
      • GeoHistogram
      • GeoSmoothHistogram
    • Related Guides
      • Statistical Visualization
      • Random Variables
      • Spatial Point Collections
      • Tabular Visualization

DensityHistogram

DensityHistogram[{{x1,y1},{x2,y2},…}]

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

DensityHistogram[{{x1,y1},{x2,y2},…},bspec]

plots a density histogram with bins specified by bspec.

DensityHistogram[{{x1,y1},{x2,y2},…},bspec,hspec]

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

Details and Options

  • DensityHistogram[data] by default plots a histogram with equal bins chosen to approximate an assumed underlying smooth distribution of the values {xi,yi}.
  • The width of each bin is computed according to the values xi, and the width according to the values yi.
  • DensityHistogram[Tabular[…]cspec] extracts and plots values from the tabular object using the column specification cspec.
  • The following forms of column specifications cspec are allowed for plotting tabular data:
  • {colx,coly}histogram values {x,y} from colx and coly
  • The following bin specifications bspec 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 DensityHistogram[data,fb] is applied to a list of all {xi,yi}, and should return an explicit bin list {{bx1,bx2,…},{by1,by2,…}}. In DensityHistogram[data,{fx,fy}], fx is applied to the list of xi, and fy to the list of yi.
  • Different forms of density histogram can be obtained by giving different bin density specifications hspec in DensityHistogram[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"counts 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 DensityHistogram[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 densities 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.
  • DensityHistogram has the same options as Graphics with the following additions and changes: [List of all options]
  • AspectRatio 1ratio of height to width
    ChartBaseStyle Automaticoverall style for tiles
    ChartElementFunction Automatichow to generate raw graphics for tiles
    ChartLegendsNonelegends for data elements and datasets
    ClippingStyleNonehow to draw values clipped by PlotRange
    ColorFunction Automatichow to color the plot
    ColorFunctionScaling Truewhether to scale the argument to ColorFunction
    FrameTruewhether to draw a frame around the plot
    FrameTicksAutomaticframe tick marks
    LabelingFunction Automatichow to label elements
    Method Automaticthe method to use for refining the plot
    PerformanceGoal $PerformanceGoalaspects of performance to try to optimize
    PlotInteractivity $PlotInteractivitywhether to allow interactive elements
    PlotRangeAutomaticthe range of f or other values to include
    PlotRangeClippingTruewhether to clip at the plot range
    PlotRangePaddingAutomatichow much to pad the range of values
    PlotTheme $PlotThemeoverall theme for the plot
    ScalingFunctionsNonehow to scale individual coordinates
  • The arguments supplied to ChartElementFunction are the bin region {{xmin,xmax},{ymin,ymax}}, the bin values lists, and metadata {m1,m2,…}.
  • The argument supplied to ColorFunction is the density for each bin.
  • With ScalingFunctions->{sx,sy,sz}, the coordinate is scaled using sx etc.
  • Style and other options are effectively applied in the order ChartBaseStyle, ColorFunction, and ChartElementFunction, with later specifications overriding earlier ones.
  • List of all options
  • Highlight options with settings specific to DensityHistogram
  • AlignmentPointCenterthe default point in the graphic to align with
    AspectRatio1ratio of height to width
    AxesFalsewhether to draw axes
    AxesLabelNoneaxes labels
    AxesOriginAutomaticwhere axes should cross
    AxesStyle{}style specifications for the axes
    BackgroundNonebackground color for the plot
    BaselinePositionAutomatichow to align with a surrounding text baseline
    BaseStyle{}base style specifications for the graphic
    ChartBaseStyleAutomaticoverall style for tiles
    ChartElementFunctionAutomatichow to generate raw graphics for tiles
    ChartLegendsNonelegends for data elements and datasets
    ClippingStyleNonehow to draw values clipped by PlotRange
    ColorFunctionAutomatichow to color the plot
    ColorFunctionScalingTruewhether to scale the argument to ColorFunction
    ContentSelectableAutomaticwhether to allow contents to be selected
    CoordinatesToolOptionsAutomaticdetailed behavior of the coordinates tool
    Epilog{}primitives rendered after the main plot
    FormatTypeTraditionalFormthe default format type for text
    FrameTruewhether to draw a frame around the plot
    FrameLabelNoneframe labels
    FrameStyle{}style specifications for the frame
    FrameTicksAutomaticframe tick marks
    FrameTicksStyle{}style specifications for frame ticks
    GridLinesNonegrid lines to draw
    GridLinesStyle{}style specifications for grid lines
    ImageMargins0.the margins to leave around the graphic
    ImagePaddingAllwhat extra padding to allow for labels etc.
    ImageSizeAutomaticthe absolute size at which to render the graphic
    LabelingFunctionAutomatichow to label elements
    LabelStyle{}style specifications for labels
    MethodAutomaticthe method to use for refining the plot
    PerformanceGoal$PerformanceGoalaspects of performance to try to optimize
    PlotInteractivity$PlotInteractivitywhether to allow interactive elements
    PlotLabelNonean overall label for the plot
    PlotRangeAutomaticthe range of f or other values to include
    PlotRangeClippingTruewhether to clip at the plot range
    PlotRangePaddingAutomatichow much to pad the range of values
    PlotRegionAutomaticthe final display region to be filled
    PlotTheme$PlotThemeoverall theme for the plot
    PreserveImageOptionsAutomaticwhether to preserve image options when displaying new versions of the same graphic
    Prolog{}primitives rendered before the main plot
    RotateLabelTruewhether to rotate y labels on the frame
    ScalingFunctionsNonehow to scale individual coordinates
    TicksAutomaticaxes ticks
    TicksStyle{}style specifications for axes ticks

Examples

open all close 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  (13)

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:

Tabular Data  (1)

Create a smooth histogram from pH and alcohol values for different wines:

Increase the number of bins to show finer granularity:

Presentation  (4)

Add labels:

Color the surface by height:

Style bins:

Use plot theme:

Options  (55)

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:

AspectRatioFull adjusts the height and width to tightly fit inside other constructs:

Axes  (3)

By default, DensityHistogram uses a frame instead of axes:

Use axes instead of a frame:

Turn on only the axis:

Turn on only the axis:

AxesLabel  (4)

No axes labels are drawn by default:

Place a label on the axis:

Specify axes labels:

Use units as labels:

AxesOrigin  (2)

The position of the axes is determined automatically:

Specify an explicit origin for the axes:

AxesStyle  (4)

Change the style for the axes:

Specify the style of each axis:

Use different styles for the ticks and the axes:

Use different styles for the labels and the axes:

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:

ImageSize  (7)

Use named sizes such as Tiny, Small, Medium and Large:

Specify the width of the plot:

Specify the height of the plot:

Allow the width and height to be up to a certain size:

Specify the width and height for a graphic, padding with space if necessary:

Setting AspectRatioFull will fill the available space:

Use maximum sizes for the width and height:

Use ImageSizeFull to fill the available space in an object:

Specify the image size as a fraction of the available space:

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:

PlotInteractivity  (2)

Histograms with a moderate number of bars automatically have tooltips and mouseover effects:

Turn off all the interactive elements:

PlotTheme  (2)

Use simple ticks in a bright color scheme:

Change color scheme:

Ticks  (4)

Ticks are placed automatically in each plot:

Use TicksNone to not draw any tick marks:

Place tick marks at specific positions:

Draw tick marks at the specified positions with the specified labels:

TicksStyle  (4)

Specify overall ticks style, including the tick labels:

Specify tick style for each of the axes:

Specify tick marks with scaled lengths:

Customize each tick with position, length, labeling and styling:

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)

See Also

Histogram3D  Histogram  SmoothDensityHistogram  SmoothHistogram3D  SmoothHistogram  HistogramList  HistogramDistribution  ArrayPlot  MatrixPlot  GeoHistogram  GeoSmoothHistogram

Related Guides

    ▪
  • Statistical Visualization
  • ▪
  • Random Variables
  • ▪
  • Spatial Point Collections
  • ▪
  • Tabular Visualization

History

Introduced in 2010 (8.0) | Updated in 2014 (10.0) ▪ 2015 (10.2) ▪ 2025 (14.2) ▪ 2025 (14.3)

Wolfram Research (2010), DensityHistogram, Wolfram Language function, https://reference.wolfram.com/language/ref/DensityHistogram.html (updated 2025).

Text

Wolfram Research (2010), DensityHistogram, Wolfram Language function, https://reference.wolfram.com/language/ref/DensityHistogram.html (updated 2025).

CMS

Wolfram Language. 2010. "DensityHistogram." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2025. https://reference.wolfram.com/language/ref/DensityHistogram.html.

APA

Wolfram Language. (2010). DensityHistogram. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DensityHistogram.html

BibTeX

@misc{reference.wolfram_2025_densityhistogram, author="Wolfram Research", title="{DensityHistogram}", year="2025", howpublished="\url{https://reference.wolfram.com/language/ref/DensityHistogram.html}", note=[Accessed: 01-December-2025]}

BibLaTeX

@online{reference.wolfram_2025_densityhistogram, organization={Wolfram Research}, title={DensityHistogram}, year={2025}, url={https://reference.wolfram.com/language/ref/DensityHistogram.html}, note=[Accessed: 01-December-2025]}

Top
Introduction for Programmers
Introductory Book
Wolfram Function Repository | Wolfram Data Repository | Wolfram Data Drop | Wolfram Language Products
Top
  • Products
  • Wolfram|One
  • Mathematica
  • Notebook Assistant + LLM Kit
  • System Modeler

  • Wolfram|Alpha Notebook Edition
  • Wolfram|Alpha Pro
  • Mobile Apps

  • Wolfram Player
  • Wolfram Engine

  • Volume & Site Licensing
  • Server Deployment Options
  • Consulting
  • Wolfram Consulting
  • Repositories
  • Data Repository
  • Function Repository
  • Community Paclet Repository
  • Neural Net Repository
  • Prompt Repository

  • Wolfram Language Example Repository
  • Notebook Archive
  • Wolfram GitHub
  • Learning
  • Wolfram U
  • Wolfram Language Documentation
  • Webinars & Training
  • Educational Programs

  • Wolfram Language Introduction
  • Fast Introduction for Programmers
  • Fast Introduction for Math Students
  • Books

  • Wolfram Community
  • Wolfram Blog
  • Public Resources
  • Wolfram|Alpha
  • Wolfram Problem Generator
  • Wolfram Challenges

  • Computer-Based Math
  • Computational Thinking
  • Computational Adventures

  • Demonstrations Project
  • Wolfram Data Drop
  • MathWorld
  • Wolfram Science
  • Wolfram Media Publishing
  • Customer Resources
  • Store
  • Product Downloads
  • User Portal
  • Your Account
  • Organization Access

  • Support FAQ
  • Contact Support
  • Company
  • About Wolfram
  • Careers
  • Contact
  • Events
Wolfram Community Wolfram Blog
Legal & Privacy Policy
WolframAlpha.com | WolframCloud.com
© 2025 Wolfram
© 2025 Wolfram | Legal & Privacy Policy |
English