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


plots a smooth kernel histogram of the values .
plots a smooth kernel histogram with estimator specification espec.
plots the distribution function dfun.
plots smooth kernel histograms for multiple datasets .
  • SmoothHistogram[data] by default plots the PDF of , based on a smooth kernel density estimate.
  • The estimator specification espec can be of the form bw or .
  • Possible distribution functions dfun include:
"PDF"probability density function
"CDF"cumulative distribution function
"SF"survival function
"HF"hazard function
"CHF"cumulative hazard function
  • The form provides a wrapper w to be applied to the resulting graphics primitives.
  • The following wrappers can be used:
Annotation[e,label]provide an annotation
Button[e,action]define an action to execute when the element is clicked
EventHandler[e,...]define a general event handler for the element
Hyperlink[e,uri]make the element act as a hyperlink
PopupWindow[e,cont]attach a popup window to the element
StatusArea[e,label]display in the status area when the element is moused over
Style[e,opts]show the element using the specified styles
Tooltip[e,label]attach an arbitrary tooltip to the element
AspectRatio1/GoldenRatioratio of width to height
AxesTruewhether to draw axes
ClippingStyleNonewhat to draw where curves are clipped
ColorFunctionAutomatichow to determine the coloring of curves
ColorFunctionScalingTruewhether to scale arguments to ColorFunction
FillingNonefilling to insert under each curve
FillingStyleAutomaticstyle to use for filling
MaxRecursionAutomaticthe maximum number of recursive subdivisions allowed
MeshNonehow many mesh points to draw on each curve
MeshFunctions{#1&}how to determine the placement of mesh points
MeshShadingNonehow to shade regions between mesh points
MeshStyleAutomaticthe style for mesh points
MethodAutomaticmethods to use
PerformanceGoal$PerformanceGoalaspects of performance to try to optimize
PlotPointsAutomaticinitial number of sample points
PlotRangeAutomaticrange of values to include
PlotRangeClippingTruewhether to clip at the plot range
PlotStyleAutomaticgraphics directives to specify the style for each object
RegionFunction(True&)how to determine whether a point should be included
ScalingFunctionsNonehow to scale individual coordinates
WorkingPrecisionMachinePrecisionthe precision used in internal computations for symbolic distributions
  • With ScalingFunctions, the coordinate is scaled using and the coordinate is scaled using .
Plot a dataset:
Plot several datasets:
Plot the probability density function of the data:
Cumulative distribution function:
Survival function:
Hazard function:
Cumulative hazard function:
Plot a dataset:
Click for copyable input
Plot several datasets:
Click for copyable input
Plot the probability density function of the data:
Click for copyable input
Click for copyable input
Cumulative distribution function:
Click for copyable input
Survival function:
Click for copyable input
Hazard function:
Click for copyable input
Cumulative hazard function:
Click for copyable input
Plot multiple datasets:
Plot different distribution functions:
PlotRange is selected automatically:
Use PlotRange to focus on areas of interest:
Non-real data points are ignored:
Specify the number of times to refine the curve:
Use wrappers on datasets:
Override the default tooltips:
Use any object in the tooltip:
Use PopupWindow to provide additional drilldown information:
Automatically select the bandwidth to use:
More data yields better approximations to the underlying distribution:
Explicitly specify the bandwidth:
Larger bandwidths yield smoother estimates:
Specify bandwidths in units of standard deviation:
Use bandwidths of and of the standard deviation:
Allow bandwidth to vary adaptively with local density:
Vary the local sensitivity from (none) to (full):
Vary the initial bandwidth for an adaptive estimate:
Specify an initial bandwidth of and respectively:
Use any of several automatic bandwidth selection methods:
Silverman's method is used by default for bandwidth selection:
The PDFs are equivalent:
Specify any one of several kernel functions:
Define the kernel function as a pure function:
Multiple datasets are automatically colored to be distinct:
Provide explicit styling to different sets:
Add labels:
Use the default tooltip for the data:
Provide an interactive tooltip for the data:
Create filled plots:
Create an overlay mesh:
Style the curve segments between mesh points:
Choose the ratio of height to width from the actual plot values:
Scale the graphic so that the height and width are the same:
Draw no axes:
Draw only the axis:
Omit clipped regions of the plot:
Show the clipped regions like the rest of the curve:
Show the clipped regions with red lines:
Show the clipped regions as red and thick:
Color by scaled and coordinates:
Color with a named color scheme:
Fill with the color used for the curve:
ColorFunction has higher priority than PlotStyle for coloring the curve:
Color the line based on scaled value:
Color the line based on unscaled value:
Use symbolic or explicit values:
By default, overlapping fills combine using opacity:
Fill between curve 1 and the axis:
Fill between curves 1 and 2:
Fill between datasets using a particular style:
Use different styles above and below the filling level:
Use different fill colors:
Fill with opacity 0.5 orange:
Fill with red when the first curve is below the second, and blue when the second is below the first:
Use a variable filling style obtained from a ColorFunction:
The default sampling mesh:
Each level of MaxRecursion will subdivide the initial mesh into a finer mesh:
Use 20 mesh levels evenly spaced in the direction:
Use an explicit list of values for the mesh in the direction:
Specify and mesh levels and styles in the direction:
Use a mesh evenly spaced in the and directions:
Show five mesh levels in the direction (red) and 10 in the direction (blue):
Alternate red and blue segments of equal width in the direction:
Use None to remove segments:
MeshShading can be used with PlotStyle:
MeshShading has higher priority than PlotStyle for styling the curve:
Use PlotStyle for some segments by setting MeshShading to Automatic:
MeshShading can be used with ColorFunction:
Color the mesh the same color as the plot:
Use a red mesh in the direction:
Use a red mesh in the direction and a blue mesh in the direction:
Use big red mesh points in the direction:
Generate a higher-quality plot:
Emphasize performance, possibly at the cost of quality:
Use more initial points to get a smoother curve:
PlotRange is automatically calculated:
Show the full range:
SmoothHistogram automatically chooses the plotting domain:
Plot over the middle 90% of the data:
Use different style directives:
By default different styles are chosen for multiple curves:
Explicitly specify the style for different curves:
PlotStyle can be combined with ColorFunction:
PlotStyle can be combined with MeshShading:
MeshStyle by default uses the same style as PlotStyle:
The velocities in km/sec of 82 galaxies from 6 well-separated conic sections of an unfilled survey of the Corona Borealis region. Multimodality in such surveys is evidence for voids and superclusters in the far universe:
Multiple modes are readily detected for a variety of bandwidths:
Observe the density over many possible bandwidths and choose one that captures important features of the data while smoothing out noise. For presentation, it is best to choose a bandwidth that slightly undersmooths the data:
Choosing 6.0 seems to capture the important features of the snowfall data:
Visually compare data to a parametric model of its density:
SmoothHistogram effectively plots the distribution function of SmoothKernelDistribution:
Use Histogram to plot the data in discrete bins:
Use SmoothDensityHistogram and SmoothHistogram3D for bivariate data:
Additional points will result in a better approximation of the underlying distribution:
As the bandwidth approaches infinity, the estimate approaches the shape of the kernel:
SmoothHistogram requires at least two values to generate a curve:
Using SmoothHistogram with multivariate data will plot multiple curves:
A visual explanation of kernel density estimation:
The estimate results from mixing the kernel functions placed at each data point:
New in 8