This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)


Updated In 8 Graphic
plots a histogram of the values .
plots a histogram with bin width specification bspec.
plots a histogram with bin heights computed according to the specification hspec.
plots histograms for multiple datasets .
  • Histogram[data] by default plots a histogram with equal bin widths chosen to approximate an assumed underlying smooth distribution of the values .
  • The following bin width specifications bspec can be given:
nuse n bins
{dx}use bins of width dx
{xmin,xmax,dx}use bins of width dx from to
{{b1,b2,...}}use the bins
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
  • The binning specification 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 Histogram is applied to a list of all , and should return an explicit bin list .
  • Different forms of histogram can be obtained by giving different bin height specifications hspec in Histogram. The following forms can be used:
"Count"the number of values lying in each bin
"CumulativeCount"cumulative counts
"SurvivalCount"survival counts
"Probability"fraction of values lying in each bin
"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 Histogram is applied to two arguments: a list of bins , and corresponding list of counts . The function should return a list of heights to be used for each of the .
  • Only values that are real numbers are assigned to bins; others are taken to be missing.
  • In Histogram, automatic bin locations are determined by combining all the datasets .
  • Histogram renders the histogram elements associated with dataset according to the specification defined by the symbolic wrapper .
AspectRatio1/GoldenRatiooverall ratio of width to height
AxesTruewhether to draw axes
BarOriginBottomorigin of histogram bars
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
ChartStyleAutomaticstyle for bars
ChartLegendsNonelegends for data elements and datasets
ColorFunctionAutomatichow to color bars
ColorFunctionScalingTruewhether to normalize arguments to ColorFunction
LabelingFunctionAutomatichow to label elements
LegendAppearanceAutomaticoverall appearance of legends
PerformanceGoal$PerformanceGoalaspects of performance to try to optimize
ScalingFunctionsNonehow to scale individual coordinates
  • The arguments supplied to ChartElementFunction are the bin region , the bin values lists, and metadata from each level in a nested list of datasets.
  • The argument supplied to ColorFunction is the height for each bin.
Generate a histogram for a list of values:
Multiple datasets:
Generate a probability histogram for a list of values:
Pictorial bars:
Use procedural bars:
Generate a histogram for a list of values:
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
Pictorial bars:
Click for copyable input
Use procedural bars:
Click for copyable input
Specify the number of bins to use:
Specify the bin width:
The bin delimiters:
The bin delimiters as an explicit list:
Use different automatic binning methods:
Use logarithmically spaced bins:
Delimit bins on integer boundaries using a binning function:
Use different height specifications:
Use a height function that accumulates the bin counts:
Bins associated with a dataset are styled the same:
Nonreal data is taken to be missing:
Use different layouts to display multiple datasets:
Control the origin of bars:
Use wrappers on individual data, datasets, or collections of datasets:
Wrappers can be nested:
Override the default tooltips:
Use PopupWindow to provide additional drilldown information:
Button can be used to trigger any action:
Use an explicit list of styles for the bars:
Use any gradient or indexed color schemes from ColorData:
ChartBaseStyle can be used to set an initial style for all chart elements:
Style can be used to override styles:
Use any graphic for pictorial bars:
Use built-in programmatically generated bars:
For detailed settings use PalettesChartElementSchemes:
Use Labeled to add a label to a dataset:
Use symbolic positions for label placement:
Provide value labels for bars by using LabelingFunction:
Use Placed to control placement and formatting:
Add categorical legend entries for datasets:
Use Legended to add additional legend entries:
Use Placed to affect the positioning of legends:
Change the bar origin:
Use ChartBaseStyle to style bars:
ChartBaseStyle combines with ChartStyle:
ChartStyle may override settings for ChartBaseStyle:
ChartBaseStyle combines with Style:
Style may override settings for ChartBaseStyle:
ColorFunction may override settings for ChartBaseStyle:
Create a pictorial chart based on any Graphics object:
Use a stretched version of the graphic:
Use explicit sizes for width and height:
Using All for width or height causes that direction to stretch to the full size of the bar:
Use a different graphic for each row of data:
Graphics are used cyclically:
Styles are inherited from styles set through ChartStyle etc:
Style can override the settings from ChartStyle:
Explicit styles set in the graphic will override other style settings:
Create true 3D shaded bars:
Get a list of built-in settings for ChartElementFunction:
For detailed settings use PalettesChartElementSchemes:
ChartElementFunction appropriate to show the global scale:
Write a custom ChartElementFunction:
Built-in element function may have options; use PalettesChartElementSchemes to set them:
Place dataset labels above each histogram:
Labeled wrappers around datasets will place additional labels:
Use Placed to control label placement:
Symbolic positions outside the bar:
Coordinate-based placement relative to a histogram:
Place all labels at the lower-left corner and vary the coordinates within the label:
Use the third argument to Placed to control formatting:
Use a named formatting function:
Use a hyperlink label:
Place multiple labels:
Use different layouts to display multiple datasets:
With multiple datasets that are fairly disjoint typically works better:
Generate a legend based on chart style:
Use Legended to add additional legend entries:
Use Legended to specify individual legend entries:
Use Placed to control the placement of legends:
Use ChartStyle to style bars:
Give a list of styles:
Use colors from ColorData:
Use colors from ColorData:
Styles are used cyclically:
Style overrides settings for ChartStyle:
ColorFunction overrides settings for ChartStyle:
ChartElements may override settings for ChartStyle:
Color by bar height:
Use ColorFunctionScaling->False to get unscaled height values:
ColorFunction overrides styles in ChartStyle:
Use ColorFunction to combine different style effects:
By default scaled height values are used:
Use ColorFunctionScaling->False, to get unscaled height values:
Use automatic labeling by values through Tooltip and StatusArea:
Do no labeling:
Use Placed to control label placement:
Coordinate-based placement relative to a bar:
Control the formatting of labels:
Use the dataset position index to generate the label:
Use the given chart labels as arguments to the labeling function:
Generate a bar chart with interactive highlighting:
Emphasize performance by disabling interactive behaviors:
Typically less memory is required for noninteractive charts:
Specify a single plot range padding for all directions:
Specify a separate plot range padding for horizontal and vertical directions:
Specify a separate plot range padding for each direction:
Overlay a plot of the PDF for a normal distribution:
Number of elements discovered each decade from 1700 to 2000:
Create a histogram of reference page sizes in Mathematica:
Distribution of lengths of human chromosomes:
Create a ListLinePlot using counts extracted from a histogram:
Click on a dataset in the histogram to hear an acoustic representation of the counts:
Click on the bars to hear the counts in the corresponding bin:
Create a matrix of handwritten digits using GraphicsDrawing Tools:
Compute the histogram of line angles used in a character drawing:
Create histograms for each digit showing the frequency of line angles:
Create a stacked histogram of male and female life expectancy for all countries:
Select a subset of languages available in DictionaryLookup:
Mouse over the bars to get the word counts with a particular string length:
Power spectrum of the Thue-Morse nested sequence
Distribution of frequencies:
Create a cumulative histogram:
Create a stacked cumulative histogram:
Wind direction from WeatherData ranges from 0° to 360°:
Get wind direction data for Willard Airport (CMI) at Champaign, Illinois:
Define a chart element function that stores bin width and count data using Sow:
Create a histogram of the wind directions, and store the bin width and frequencies:
Create a polar histogram of the wind direction frequencies:
Histogram automatically determines bins to use based on data:
Use BinCounts for explicit binning of data:
Display using BarChart:
Use PDF to get parametric probability density function:
Show together with Histogram of random data:
Overlay several PDF plots for Poisson distributions:
New in 7 | Last modified in 8