WOLFRAM

SmoothHistogram[{x1,x2,}]

plots a smooth kernel histogram for the PDF of the values xi.

SmoothHistogram[{x1,x2,},espec]

plots a smooth kernel histogram with estimator specification espec.

SmoothHistogram[{x1,x2,},espec,dfun]

plots the distribution function dfun.

SmoothHistogram[{data1,data2,},]

plots smooth kernel histograms for multiple datasets datai.

Details and Options

Examples

open allclose all

Basic Examples  (3)Summary of the most common use cases

Plot a dataset:

Out[1]=1

Plot several datasets:

Out[1]=1

Plot the probability density function of the data:

Out[2]=2

Cumulative distribution function:

Out[3]=3

Survival function:

Out[4]=4

Hazard function:

Out[5]=5

Cumulative hazard function:

Out[6]=6

Scope  (30)Survey of the scope of standard use cases

Data  (11)

Plot multiple datasets:

Out[1]=1

Plot different distribution functions:

Out[1]=1

PlotRange is selected automatically:

Out[2]=2

Use PlotRange to focus on areas of interest:

Out[3]=3

Non-real data points are ignored:

Out[2]=2

Specify the number of times to refine the curve:

Out[1]=1

Use wrappers on datasets:

Out[2]=2

Override the default tooltips:

Out[2]=2

Use any object in the tooltip:

Out[3]=3

Use PopupWindow to provide additional drilldown information:

Out[2]=2

Numeric values in an association are used as the y coordinates:

Out[1]=1

Numeric keys and values in an association are used as the x and y coordinates:

Out[2]=2

Plot time series directly:

Out[1]=1
Out[2]=2

The weights in WeightedData are ignored:

Out[1]=1

Tabular Data  (1)

Get tabular data:

Out[1]=1

Create a smooth histogram for the city mileage:

Out[2]=2

Compare the distributions of city and highway mileages:

Out[3]=3

Vary the bandwidth to affect the smoothness of the histograms:

Out[4]=4

Bandwidth and Kernel  (9)

Automatically select the bandwidth to use:

More data yields better approximations to the underlying distribution:

Out[2]=2

Explicitly specify the bandwidth:

Larger bandwidths yield smoother estimates:

Out[2]=2

Specify bandwidths in units of standard deviation:

Use bandwidths of and of the standard deviation:

Out[2]=2

Allow bandwidth to vary adaptively with local density:

Vary the local sensitivity from (none) to (full):

Out[2]=2

Vary the initial bandwidth for an adaptive estimate:

Specify an initial bandwidth of and respectively:

Out[3]=3

Use any of several automatic bandwidth selection methods:

Out[2]=2

Silverman's method is used by default for bandwidth selection:

The PDFs are equivalent:

Out[2]=2

Specify any one of several kernel functions:

Out[2]=2

Define the kernel function as a pure function:

Out[2]=2

Presentation  (9)

Multiple datasets are automatically colored to be distinct:

Out[2]=2

Provide explicit styling to different sets:

Out[2]=2

Use rows and columns of individual plots to show multiple sets:

Out[1]=1
Out[2]=2

Add labels:

Out[1]=1

Use the default tooltip for the data:

Out[2]=2

Provide an interactive tooltip for the data:

Out[2]=2

Create filled plots:

Out[2]=2

Create an overlay mesh:

Out[1]=1

Style the curve segments between mesh points:

Out[1]=1

Options  (79)Common values & functionality for each option

AspectRatio  (4)

By default, SmoothHistogram uses a fixed height to width ratio for the plot:

Out[1]=1

Make the height the same as the width with AspectRatio1:

Out[1]=1

AspectRatioAutomatic determines the ratio from the plot ranges:

Out[1]=1

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

Out[2]=2

Axes  (4)

By default, axes are drawn:

Out[1]=1

Use AxesFalse to turn off axes:

Out[1]=1

Use AxesOrigin to specify where the axes intersect:

Out[1]=1

Turn each axis on individually:

Out[1]=1

AxesLabel  (4)

No axes labels are drawn by default:

Out[3]=3

Place a label on the axis:

Out[1]=1

Specify axes labels:

Out[1]=1

Use units as labels:

Out[1]=1

AxesOrigin  (2)

The position of the axes is determined automatically:

Out[1]=1

Specify an explicit origin for the axes:

Out[1]=1

AxesStyle  (4)

Change the style for the axes:

Out[1]=1

Specify the style of each axis:

Out[1]=1

Use different styles for the ticks and the axes:

Out[1]=1

Use different styles for the labels and the axes:

Out[1]=1

ClippingStyle  (4)

Omit clipped regions of the plot:

Out[1]=1

Show the clipped regions like the rest of the curve:

Out[1]=1

Show the clipped regions with red lines:

Out[1]=1

Show the clipped regions as red and thick:

Out[1]=1

ColorFunction  (5)

Color by scaled and coordinates:

Out[1]=1

Color with a named color scheme:

Out[1]=1

Fill with the color used for the curve:

Out[1]=1

ColorFunction has higher priority than PlotStyle for coloring the curve:

Out[1]=1

Use Automatic in MeshShading to use ColorFunction:

Out[1]=1

ColorFunctionScaling  (2)

Color the line based on scaled value:

Out[1]=1

Color the line based on unscaled value:

Out[1]=1

Filling  (6)

Use symbolic or explicit values:

Out[1]=1

By default, overlapping fills combine using opacity:

Out[1]=1

Fill between curve 1 and the axis:

Out[1]=1

Fill between curves 1 and 2:

Out[1]=1

Fill between datasets using a particular style:

Out[1]=1

Use different styles above and below the filling level:

Out[1]=1

FillingStyle  (4)

Use different fill colors:

Out[1]=1

Fill with opacity 0.5 orange:

Out[1]=1

Fill with red when the first curve is below the second, and blue when the second is below the first:

Out[1]=1

Use a variable filling style obtained from a ColorFunction:

Out[1]=1

ImageSize  (7)

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

Out[1]=1

Specify the width of the plot:

Out[1]=1

Specify the height of the plot:

Out[2]=2

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

Out[1]=1

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

Out[1]=1

Setting AspectRatioFull will fill the available space:

Out[2]=2

Use maximum sizes for the width and height:

Out[1]=1

Use ImageSizeFull to fill the available space in an object:

Out[1]=1

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

Out[1]=1

MaxRecursion  (2)

The default sampling mesh:

Out[1]=1

Each level of MaxRecursion will subdivide the initial mesh into a finer mesh:

Out[1]=1

Mesh  (3)

Use 20 mesh levels evenly spaced in the direction:

Out[1]=1

Use an explicit list of values for the mesh in the direction:

Out[1]=1

Specify and mesh levels and styles in the direction:

Out[1]=1

MeshFunctions  (2)

Use a mesh evenly spaced in the and directions:

Out[1]=1

Show five mesh levels in the direction (red) and 10 in the direction (blue):

Out[1]=1

MeshShading  (6)

Alternate red and blue segments of equal width in the direction:

Out[1]=1

Use None to remove segments:

Out[1]=1

MeshShading can be used with PlotStyle:

Out[1]=1

MeshShading has higher priority than PlotStyle for styling the curve:

Out[1]=1

Use PlotStyle for some segments by setting MeshShading to Automatic:

Out[1]=1

MeshShading can be used with ColorFunction:

Out[1]=1

MeshStyle  (4)

Color the mesh the same color as the plot:

Out[1]=1

Use a red mesh in the direction:

Out[1]=1

Use a red mesh in the direction and a blue mesh in the direction:

Out[1]=1

Use big, red mesh points in the direction:

Out[1]=1

PerformanceGoal  (2)

Generate a higher-quality plot:

Out[1]=1

Emphasize performance, possibly at the cost of quality:

Out[1]=1

PlotLayout  (3)

Place each histogram in a separate panel using shared axes:

Out[9]=9

Use a row instead of a column:

Out[10]=10

Use multiple columns or rows:

Out[1]=1

Prefer full columns or rows:

Out[1]=1
Out[2]=2

PlotPoints  (1)

Use more initial points to get a smoother curve:

Out[1]=1

PlotRange  (2)

PlotRange is automatically calculated:

Out[2]=2

Show the full range:

Out[3]=3

SmoothHistogram automatically chooses the plotting domain:

Out[2]=2

Plot over the middle 90% of the data:

Out[3]=3

PlotStyle  (6)

Use different style directives:

Out[1]=1

By default, different styles are chosen for multiple curves:

Out[1]=1

Explicitly specify the style for different curves:

Out[1]=1

PlotStyle can be combined with ColorFunction:

Out[1]=1

PlotStyle can be combined with MeshShading:

Out[1]=1

MeshStyle by default uses the same style as PlotStyle:

Out[1]=1

PlotTheme  (2)

Use a theme with simple ticks and grid lines in a high contrast color scheme:

Out[1]=1

Change the color scheme:

Out[1]=1

Applications  (4)Sample problems that can be solved with this function

The velocities in km/sec of 82 galaxies from six 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:

Out[3]=3

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:

Out[2]=2

Choosing 6.0 seems to capture the important features of the snowfall data:

Out[3]=3

Visually compare data to a parametric model of its density:

Out[2]=2
Out[3]=3

Smooth histogram for the slice distribution of a random process:

Out[2]=2

Smooth histogram for several slices of a process:

Out[4]=4

Properties & Relations  (5)Properties of the function, and connections to other functions

SmoothHistogram effectively plots the distribution function of SmoothKernelDistribution:

Out[2]=2

Use Histogram to plot the data in discrete bins:

Out[2]=2
Out[3]=3

Use SmoothDensityHistogram and SmoothHistogram3D for bivariate data:

Out[2]=2

Additional points will result in a better approximation of the underlying distribution:

Out[2]=2

As the bandwidth approaches infinity, the estimate approaches the shape of the kernel:

Out[3]=3

Possible Issues  (1)Common pitfalls and unexpected behavior

Using SmoothHistogram with multivariate data will plot multiple curves:

Out[1]=1
Out[2]=2

Neat Examples  (1)Surprising or curious use cases

A visual explanation of kernel density estimation:

The estimate results from mixing the kernel functions placed at each data point:

Out[6]=6
Wolfram Research (2010), SmoothHistogram, Wolfram Language function, https://reference.wolfram.com/language/ref/SmoothHistogram.html (updated 2025).
Wolfram Research (2010), SmoothHistogram, Wolfram Language function, https://reference.wolfram.com/language/ref/SmoothHistogram.html (updated 2025).

Text

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

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

CMS

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

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

APA

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

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

BibTeX

@misc{reference.wolfram_2025_smoothhistogram, author="Wolfram Research", title="{SmoothHistogram}", year="2025", howpublished="\url{https://reference.wolfram.com/language/ref/SmoothHistogram.html}", note=[Accessed: 17-May-2025 ]}

@misc{reference.wolfram_2025_smoothhistogram, author="Wolfram Research", title="{SmoothHistogram}", year="2025", howpublished="\url{https://reference.wolfram.com/language/ref/SmoothHistogram.html}", note=[Accessed: 17-May-2025 ]}

BibLaTeX

@online{reference.wolfram_2025_smoothhistogram, organization={Wolfram Research}, title={SmoothHistogram}, year={2025}, url={https://reference.wolfram.com/language/ref/SmoothHistogram.html}, note=[Accessed: 17-May-2025 ]}

@online{reference.wolfram_2025_smoothhistogram, organization={Wolfram Research}, title={SmoothHistogram}, year={2025}, url={https://reference.wolfram.com/language/ref/SmoothHistogram.html}, note=[Accessed: 17-May-2025 ]}