SmoothDensityHistogram[{{x1,y1},{x2,y2},…}]
plots a smooth kernel histogram of the values {xi,yi}.
SmoothDensityHistogram[{{x1,y1},{x2,y2},…},espec]
plots a smooth kernel histogram with estimator specification espec.
SmoothDensityHistogram[{{x1,y1},{x2,y2},…},espec,dfun]
plots the distribution function dfun.
SmoothDensityHistogram
SmoothDensityHistogram[{{x1,y1},{x2,y2},…}]
plots a smooth kernel histogram of the values {xi,yi}.
SmoothDensityHistogram[{{x1,y1},{x2,y2},…},espec]
plots a smooth kernel histogram with estimator specification espec.
SmoothDensityHistogram[{{x1,y1},{x2,y2},…},espec,dfun]
plots the distribution function dfun.
Details and Options
- SmoothDensityHistogram[data] by default generates colorized grayscale output of the PDF of {{x1,y1},…}, based on a smooth kernel density estimate.
- The estimator specification espec can be of the form bw or {bw,kernel}.
- The specifications for bandwidth bw and kernel are the same as for SmoothKernelDistribution.
- SmoothDensityHistogram[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 - Possible distribution functions dfun include:
-
"PDF" probability density function "Intensity" count density function "CDF" cumulative distribution function "SF" survival function "HF" hazard function "CHF" cumulative hazard function - The form w[data] 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 - SmoothDensityHistogram has the same options as Graphics, with the following additions and changes: [List of all options]
-
AspectRatio 1 ratio of height to width BoundaryStyle None how to draw RegionFunction boundaries BoxRatios Automatic effective 3D bounding box ratios ClippingStyle None how to draw values clipped by PlotRange ColorFunction Automatic how to color the plot ColorFunctionScaling True whether to scale the argument to ColorFunction Frame True whether to draw a frame around the plot FrameTicks Automatic frame tick marks LightingAngle None effective angle of the simulated light source MaxRecursion Automatic the maximum number of recursive subdivisions allowed Mesh None how many mesh lines to draw MeshFunctions {#3&} how to determine the placement of mesh lines MeshShading Automatic how to shade regions between mesh lines MeshStyle Automatic the style for mesh lines Method Automatic the method to use for refining the plot PerformanceGoal $PerformanceGoal aspects of performance to try to optimize PlotPoints Automatic the initial number of sample points for the function in each direction PlotRange Automatic the range of f or other values to include PlotRangeClipping True whether to clip at the plot range PlotRangePadding Automatic how much to pad the range of values PlotTheme $PlotTheme overall theme for the plot RegionFunction (True&) how to determine whether a point should be included ScalingFunctions None how to scale individual coordinates WorkingPrecision MachinePrecision the precision used in internal computations - ColorFunction is supplied with a single argument, given by default by the scaled value of f, the PDF, CDF, etc. of the distribution.
- The arguments supplied to RegionFunction are x, y, and f, where f can be the PDF, CDF, etc. of the distribution.
- With the setting MeshShading->Automatic, the colors between mesh lines are computed from the ColorFunction setting.
- With ScalingFunctions->{sx,sy,sz}, the
coordinate is scaled using sx, the
coordinate is scaled using sy, and the
coordinate is scaled using sz. -
AlignmentPoint Center the default point in the graphic to align with AspectRatio 1 ratio of height to width Axes False whether to draw axes AxesLabel None axes labels AxesOrigin Automatic where axes should cross AxesStyle {} style specifications for the axes Background None background color for the plot BaselinePosition Automatic how to align with a surrounding text baseline BaseStyle {} base style specifications for the graphic BoundaryStyle None how to draw RegionFunction boundaries BoxRatios Automatic effective 3D bounding box ratios ClippingStyle None how to draw values clipped by PlotRange ColorFunction Automatic how to color the plot ColorFunctionScaling True whether to scale the argument to ColorFunction ContentSelectable Automatic whether to allow contents to be selected CoordinatesToolOptions Automatic detailed behavior of the coordinates tool Epilog {} primitives rendered after the main plot FormatType TraditionalForm the default format type for text Frame True whether to draw a frame around the plot FrameLabel None frame labels FrameStyle {} style specifications for the frame FrameTicks Automatic frame tick marks FrameTicksStyle {} style specifications for frame ticks GridLines None grid lines to draw GridLinesStyle {} style specifications for grid lines ImageMargins 0. the margins to leave around the graphic ImagePadding All what extra padding to allow for labels etc. ImageSize Automatic the absolute size at which to render the graphic LabelStyle {} style specifications for labels LightingAngle None effective angle of the simulated light source MaxRecursion Automatic the maximum number of recursive subdivisions allowed Mesh None how many mesh lines to draw MeshFunctions {#3&} how to determine the placement of mesh lines MeshShading Automatic how to shade regions between mesh lines MeshStyle Automatic the style for mesh lines Method Automatic the method to use for refining the plot PerformanceGoal $PerformanceGoal aspects of performance to try to optimize PlotLabel None an overall label for the plot PlotPoints Automatic the initial number of sample points for the function in each direction PlotRange Automatic the range of f or other values to include PlotRangeClipping True whether to clip at the plot range PlotRangePadding Automatic how much to pad the range of values PlotRegion Automatic the final display region to be filled PlotTheme $PlotTheme overall theme for the plot PreserveImageOptions Automatic whether to preserve image options when displaying new versions of the same graphic Prolog {} primitives rendered before the main plot RegionFunction (True&) how to determine whether a point should be included RotateLabel True whether to rotate y labels on the frame ScalingFunctions None how to scale individual coordinates Ticks Automatic axes ticks TicksStyle {} style specifications for axes ticks WorkingPrecision MachinePrecision the precision used in internal computations
List of all options
Examples
open all close allBasic Examples (2)
Plot a smooth density function for a dataset:
SmoothDensityHistogram[RandomVariate[BinormalDistribution[.5], 10]]Plot the probability density function of the data:
data = RandomVariate[BinormalDistribution[.5], 100];SmoothDensityHistogram[data, Automatic, "PDF"]Cumulative distribution function:
SmoothDensityHistogram[data, Automatic, "CDF"]SmoothDensityHistogram[data, Automatic, "SF"]SmoothDensityHistogram[data, Automatic, "HF"]SmoothDensityHistogram[data, Automatic, "CHF"]Scope (23)
Data and Wrappers (8)
Plot different distribution functions:
Table[SmoothDensityHistogram[RandomVariate[BinormalDistribution[.2], 1000], Automatic, dfun, PlotLabel -> dfun], {dfun, {"PDF", "CDF", "SF", "HF", "CHF"}}]PlotRange is selected automatically:
data = RandomVariate[BinormalDistribution[.2], 10 ^ 3];SmoothDensityHistogram[data]Use PlotRange to focus on areas of interest:
SmoothDensityHistogram[data, PlotRange -> {{-1, 1}, {-1, 1}}]Nonreal data points are ignored:
data = {{2.0, 1.9}, {1.0, 1.1}, {0.4, 1.3}, {1.2, 0. + 0.5 I}, {1., 0. + 0.9 I}};{SmoothDensityHistogram[data], SmoothDensityHistogram[Cases[data, {_Real, _Real}]]}Specify the number of points to use:
SmoothDensityHistogram[RandomVariate[BinormalDistribution[.2], 100], PlotPoints -> 10]Specify the number of times to refine the curve:
SmoothDensityHistogram[RandomVariate[BinormalDistribution[.5], 100], MaxRecursion -> 0]data = RandomVariate[BinormalDistribution[.5], 10 ^ 3];SmoothDensityHistogram[PopupWindow[data, "Binormal Distribution"]]data = RandomVariate[BinormalDistribution[.5], 10 ^ 3];SmoothDensityHistogram[Tooltip[data]]Override the default tooltips:
data = RandomVariate[BinormalDistribution[.5], 10 ^ 3];SmoothDensityHistogram[Tooltip[data, "Binormal distribution"]]Tabular Data (1)
tab = Tabular[ResourceData["Sample Data: Wine Quality"]]Create a smooth histogram from pH and alcohol values for different wines:
SmoothDensityHistogram[tab -> {"PH", "Alcohol"}]Increase the bandwidth for a smoother plot:
SmoothDensityHistogram[tab -> {"PH", "Alcohol"}, {"Standardized", 0.5}]Bandwidth and Kernel (9)
Specify a single bandwidth for bivariate data:
data = RandomVariate[BinormalDistribution[.75], 100];Table[SmoothDensityHistogram[data, bw, ColorFunction -> "DeepSeaColors"], {bw, {.1, 1}}]Specify bivariate bandwidths in units of standard deviation:
data = RandomVariate[BinormalDistribution[.75], 100];Table[SmoothDensityHistogram[data, bw, ColorFunction -> "TemperatureMap"], {bw, {.1, 1}}]Allow bivariate bandwidths to vary adaptively with local density:
data = RandomVariate[BinormalDistribution[.75], 100];Use the local sensitivity from
(small) to
(large):
Table[SmoothDensityHistogram[data, bw], {bw, {{"Adaptive", Automatic, 0.25}, {"Adaptive", Automatic, 0.75}}}]Vary the initial bandwidth for an adaptive estimate:
data = RandomVariate[BinormalDistribution[.75], 100];Use initial bandwidths of
and
:
Table[SmoothDensityHistogram[data, bw], {bw, {{"Adaptive", 1.0, .5}, {"Adaptive", 0.25, .5}}}]Use any of several automatic bandwidth selection methods:
data = RandomVariate[BinormalDistribution[.5], 10 ^ 2];Table[SmoothDensityHistogram[data, name, PlotLabel -> name], {name, {"LeastSquaresCrossValidation", "Oversmooth", "Scott", "SheatherJones", "StandardDeviation", "StandardGaussian"}}]Silverman's method is used by default for bandwidth selection:
data = RandomVariate[BinormalDistribution[.5], 10 ^ 3];Table[SmoothDensityHistogram[data, bw], {bw, {"Silverman", Automatic}}]Use different bandwidth specifications in each dimension:
data = RandomVariate[BinormalDistribution[.95], 100];SmoothDensityHistogram[data, {1, {"Standardized", 1}} ]Specify any one of several kernel functions:
data = RandomVariate[BinormalDistribution[.5], 100];Table[SmoothDensityHistogram[data, {Automatic, i}, PlotLabel -> i, FrameTicks -> None], {i, {"Biweight", "Cosine", "Epanechnikov", "Gaussian", "Rectangular", "SemiCircle", "Triangular", "Triweight"}}]Define the kernel function as a pure function:
data = RandomVariate[BinormalDistribution[.5], 100];Table[SmoothDensityHistogram[data, {Automatic, ker}], {ker, {"Gaussian", (1/π (1 + #1^2))&}}]Presentation (5)
SmoothDensityHistogram[RandomVariate[BinormalDistribution[.5], 10 ^ 4], FrameLabel -> {"x", "y"}, PlotLabel -> "Binormal distribution"]SmoothDensityHistogram[RandomVariate[BinormalDistribution[.5], 10 ^ 4], ColorFunction -> "SolarColors"]SmoothDensityHistogram[RandomVariate[BinormalDistribution[0.1], 100], Mesh -> 20]SmoothDensityHistogram[RandomVariate[BinormalDistribution[0.1], 100], Mesh -> 20, MeshStyle -> Directive[Gray, Dashed]]SmoothDensityHistogram[RandomVariate[BinormalDistribution[0.1], 100], PlotTheme -> "Monochrome"]Options (68)
AspectRatio (4)
By default, SmoothDensityHistogram uses the same width and height:
SmoothDensityHistogram[IconizedObject[«data»]]Use a numerical value to specify the height to width ratio:
SmoothDensityHistogram[IconizedObject[«data»], AspectRatio -> 1 / 2]AspectRatioAutomatic determines the ratio from the plot ranges:
SmoothDensityHistogram[IconizedObject[«data»], AspectRatio -> Automatic]AspectRatioFull adjusts the height and width to tightly fit inside other constructs:
plot = SmoothDensityHistogram[IconizedObject[«data»], AspectRatio -> Full];{Framed[Pane[plot, {50, 100}]], Framed[Pane[plot, {100, 100}]], Framed[Pane[plot, {100, 50}]]}Axes (3)
By default, SmoothDensityHistogram uses a frame instead of axes:
SmoothDensityHistogram[IconizedObject[«data»]]SmoothDensityHistogram[IconizedObject[«data»], Frame -> False, Axes -> True]Turn on each axis individually:
{SmoothDensityHistogram[IconizedObject[«data»], Frame -> False, Axes -> {True, False}], SmoothDensityHistogram[IconizedObject[«data»], Frame -> False, Axes -> {False, True}]}AxesLabel (4)
No axes labels are drawn by default:
SmoothDensityHistogram[IconizedObject[«data»], Frame -> False, Axes -> True]SmoothDensityHistogram[IconizedObject[«data»], Frame -> False, Axes -> True, AxesLabel -> y]SmoothDensityHistogram[IconizedObject[«data»], Frame -> False, Axes -> True, AxesLabel -> {x, y}]SmoothDensityHistogram[QuantityArray[IconizedObject[«data»], "Meters"], Frame -> False, Axes -> True, AxesLabel -> Automatic]AxesOrigin (2)
The position of the axes is determined automatically:
SmoothDensityHistogram[IconizedObject[«data»], Frame -> False, Axes -> True]Specify an explicit origin for the axes:
SmoothDensityHistogram[IconizedObject[«data»], Frame -> False, Axes -> True, AxesOrigin -> {1, 1}]AxesStyle (3)
Change the style for the axes:
SmoothDensityHistogram[IconizedObject[«data»], Frame -> False, Axes -> True, AxesStyle -> Red]Specify the style of each axis:
SmoothDensityHistogram[IconizedObject[«data»], Frame -> False, Axes -> True, AxesStyle -> {{Thick, Red}, {Thick, Blue}}]Use different styles for the ticks and the axes:
SmoothDensityHistogram[IconizedObject[«data»], Frame -> False, Axes -> True, AxesStyle -> Green, TicksStyle -> Black]BoundaryStyle (2)
Use a red boundary around the edges of the surface:
SmoothDensityHistogram[RandomVariate[BinormalDistribution[.5], 10], BoundaryStyle -> Red]BoundaryStyle applies to regions cut by RegionFunction:
SmoothDensityHistogram[RandomVariate[BinormalDistribution[.5], 10], BoundaryStyle -> Red, RegionFunction -> Function[{x, y, z}, x ^ 2 + y ^ 2 ≥ 1]]ClippingStyle (4)
Show clipped regions like the rest of the surface:
SmoothDensityHistogram[RandomVariate[BinormalDistribution[.5], 10], Automatic, "HF", ClippingStyle -> Automatic]SmoothDensityHistogram[RandomVariate[BinormalDistribution[.5], 10], Automatic, "HF", ClippingStyle -> None]Use pink to fill the clipped regions:
SmoothDensityHistogram[RandomVariate[BinormalDistribution[.5], 10], Automatic, "HF", ClippingStyle -> Pink]Use blue where the surface is clipped above and red below:
SmoothDensityHistogram[RandomVariate[BinormalDistribution[.5], 10], ClippingStyle -> {Red, Blue}, PlotRange -> {0.02, 0.1}]ColorFunction (5)
SmoothDensityHistogram[RandomVariate[BinormalDistribution[.5], 10], ColorFunction -> Hue]Specify gray-level intensity by scaled
coordinate:
SmoothDensityHistogram[RandomVariate[BinormalDistribution[.5], 10], ColorFunction -> GrayLevel]Named color gradients color in the
direction:
SmoothDensityHistogram[RandomVariate[BinormalDistribution[.5], 10], ColorFunction -> "SunsetColors"]Use brightness to correspond to the height or density of a function:
SmoothDensityHistogram[RandomVariate[BinormalDistribution[.5], 10], ColorFunction -> (Hue[2 / 5, 2 / 3, #]&)]Use the interpolation between two colors to indicate the height or density of a function:
SmoothDensityHistogram[RandomVariate[BinormalDistribution[.5], 10], ColorFunction -> (Blend[{Magenta, Cyan}, #]&)]ColorFunctionScaling (1)
Color using the natural range of values by setting ColorFunctionScaling to False:
SmoothDensityHistogram[RandomVariate[MultivariatePoissonDistribution[0.1, {.1, 0.9}], 50], ColorFunction -> (ColorData["SolarColors"][#1]&), ColorFunctionScaling -> False]Frame (2)
ImageSize (7)
Use named sizes such as Tiny, Small, Medium and Large:
{SmoothDensityHistogram[IconizedObject[«data»], ImageSize -> Tiny], SmoothDensityHistogram[IconizedObject[«data»], ImageSize -> Small]}Specify the width of the plot:
{SmoothDensityHistogram[IconizedObject[«data»], ImageSize -> 150], SmoothDensityHistogram[IconizedObject[«data»], AspectRatio -> 1.5, ImageSize -> 150]}Specify the height of the plot:
{SmoothDensityHistogram[IconizedObject[«data»], ImageSize -> {Automatic, 150}], SmoothDensityHistogram[IconizedObject[«data»], AspectRatio -> 2, ImageSize -> {Automatic, 150}]}Allow the width and height to be up to a certain size:
{SmoothDensityHistogram[IconizedObject[«data»], ImageSize -> UpTo[200]], SmoothDensityHistogram[IconizedObject[«data»], AspectRatio -> 2, ImageSize -> UpTo[200]]}Specify the width and height for a graphic, padding with space if necessary:
SmoothDensityHistogram[IconizedObject[«data»], ImageSize -> {200, 200}, Background -> StandardGray]Setting AspectRatioFull will fill the available space:
SmoothDensityHistogram[IconizedObject[«data»], AspectRatio -> Full, ImageSize -> {200, 200}, Background -> StandardGray]Use maximum sizes for the width and height:
{SmoothDensityHistogram[IconizedObject[«data»], ImageSize -> {UpTo[150], UpTo[100]}], SmoothDensityHistogram[IconizedObject[«data»], AspectRatio -> 2, ImageSize -> {UpTo[150], UpTo[100]}]}Use ImageSizeFull to fill the available space in an object:
Framed[Pane[SmoothDensityHistogram[IconizedObject[«data»], ImageSize -> Full, Background -> StandardGray], {200, 200}]]Specify the image size as a fraction of the available space:
Framed[Pane[SmoothDensityHistogram[IconizedObject[«data»], AspectRatio -> Full, ImageSize -> {Scaled[0.5], Scaled[0.5]}, Background -> StandardGray], {200, 200}]]MaxRecursion (1)
Mesh (7)
SmoothDensityHistogram typically has 10 mesh lines in the
direction:
SmoothDensityHistogram[RandomVariate[BinormalDistribution[.5], 10]]Use 5 mesh lines in the
direction:
SmoothDensityHistogram[RandomVariate[BinormalDistribution[.5], 10], Mesh -> 5]SmoothDensityHistogram[RandomVariate[BinormalDistribution[.5], 10], Mesh -> None]Show the complete sampling mesh:
SmoothDensityHistogram[RandomVariate[BinormalDistribution[.5], 10], Mesh -> All]Use 3 mesh lines in the
direction and 6 mesh lines in the
direction:
SmoothDensityHistogram[RandomVariate[BinormalDistribution[.5], 10], Mesh -> {3, 6}, MeshFunctions -> {#1&, #2&}]Use mesh lines at specific values:
SmoothDensityHistogram[RandomVariate[BinormalDistribution[.5], 10], Mesh -> {{-1, 1}, {0}}, MeshFunctions -> {#1&, #2&}]Use different styles for different mesh lines:
SmoothDensityHistogram[RandomVariate[BinormalDistribution[.5], 10], Mesh -> {{{0, Thick}}, {{0, Red}}}, MeshFunctions -> {#1&, #2&}]MeshFunctions (3)
Use the
value as the mesh function:
SmoothDensityHistogram[RandomVariate[BinormalDistribution[.5], 10], MeshFunctions -> {#3&}, Mesh -> 5]Use mesh lines in the
and
directions:
SmoothDensityHistogram[RandomVariate[BinormalDistribution[.5], 10], MeshFunctions -> {#1&, #2&}, Mesh -> {5, 5}]Use mesh lines corresponding to fixed distances from the mean:
data = RandomVariate[BinormalDistribution[.5], 10];SmoothDensityHistogram[data, MeshFunctions -> {Norm[{#1, #2} - Mean[data]]&}, Mesh -> 5, AspectRatio -> Automatic]MeshStyle (2)
SmoothDensityHistogram[RandomVariate[BinormalDistribution[.5], 10], MeshStyle -> Red, Mesh -> 3]Use red mesh lines in the
direction and dashed mesh lines in the
direction:
SmoothDensityHistogram[RandomVariate[BinormalDistribution[.5], 10], MeshStyle -> {Red, Dashed}, MeshFunctions -> {#1&, #2&}, Mesh -> 3]PlotPoints (1)
PlotRange (3)
SmoothHistogram3D automatically selects the domain:
data = RandomVariate[BinormalDistribution[.5], 10];SmoothDensityHistogram[data]Use the full domain generated by SmoothKernelDistribution:
data = RandomVariate[BinormalDistribution[.5], 10];SmoothDensityHistogram[data, PlotRange -> Full]Explicitly provide the domain:
data = RandomVariate[BinormalDistribution[.5], 10];SmoothDensityHistogram[data, PlotRange -> {{-2, 2}, {-2, 2}}]PlotTheme (2)
Use a theme with simple ticks and grid lines in a bright color scheme:
SmoothDensityHistogram[RandomVariate[BinormalDistribution[0.1], 100], PlotTheme -> "Business"]SmoothDensityHistogram[RandomVariate[BinormalDistribution[0.1], 100], PlotTheme -> "Business", ColorFunction -> "SunsetColors"]RegionFunction (4)
Clip small values of the surface:
SmoothDensityHistogram[RandomVariate[BinormalDistribution[.5], 10], RegionFunction -> Function[{x, y, z}, z > 0.01]]BoundaryStyle is used where the region is clipped:
SmoothDensityHistogram[RandomVariate[BinormalDistribution[.5], 10], RegionFunction -> Function[{x, y, z}, z > 0.05], Filling -> 0, BoundaryStyle -> Red]Regions do not have to be connected:
SmoothDensityHistogram[RandomVariate[BinormalDistribution[.5], 10], RegionFunction -> Function[{x, y, z}, 0 < Mod[x + y, 2] < 1]]Use any logical combination of conditions:
SmoothDensityHistogram[RandomVariate[BinormalDistribution[.5], 10], RegionFunction -> Function[{x, y, z}, x < 0 || y > 0]]Ticks (4)
Ticks are placed automatically in each histogram:
SmoothDensityHistogram[IconizedObject[«data»], Frame -> False, Axes -> True]Use TicksNone to not draw any tick marks:
SmoothDensityHistogram[IconizedObject[«data»], Frame -> False, Axes -> True, Ticks -> None]Place tick marks at specific positions:
SmoothDensityHistogram[IconizedObject[«data»], Frame -> False, Axes -> True, Ticks -> {{-2, 1, 2}, {-2, 1, 2}}]Draw tick marks at the specified positions with the specified labels:
SmoothDensityHistogram[IconizedObject[«data»], Frame -> False, Axes -> True, Ticks -> {{{-2, -a}, {1, b}, {2, a}}, {{-2, -a}, {1, b}, {2, a}}}]TicksStyle (4)
Specify the overall tick style, including the tick labels:
SmoothDensityHistogram[IconizedObject[«data»], Frame -> False, Axes -> True, TicksStyle -> Directive[Black, Bold]]Specify the tick style for each of the axes:
SmoothDensityHistogram[IconizedObject[«data»], Frame -> False, Axes -> True, TicksStyle -> {Directive[Black, Bold], Directive[Bold, Red]}]Specify tick marks with scaled lengths:
SmoothDensityHistogram[IconizedObject[«data»], Frame -> False, Axes -> True, TicksStyle -> White, Ticks -> {{{-2, -a, .05}, {1, b, .1}, {2, a, .2}}, {{-2, -a, .05}, {1, b, .1}, {2, a, .2}}}]Customize each tick with position, length, labeling and styling:
SmoothDensityHistogram[IconizedObject[«data»], Frame -> False, Axes -> True, Ticks -> {{{-2, -a, .05, Directive[Red, Thick]}, {1, b, .1, Directive[Red, Thick]}, {2, a, .2, Directive[Red, Dashed, Thick]}}, {{-2, -a, .05, Directive[White, Thick]}, {1, b, .1, Directive[White, Thick]}, {2, a, .2, Directive[White, Dashed, Thick]}}}]Applications (2)
Show the distribution of eruptions of the Old Faithful geyser at Yellowstone National Park:
SmoothDensityHistogram[ExampleData[{"Statistics", "OldFaithful"}], FrameLabel -> {"Duration (minutes)", "Interval (minutes)"}, PlotLabel -> "Old Faitful Eruptions"]Smooth density histogram for a multivariate time slice of a random process:
data = RandomVariate[WienerProcess[3, 4][{7, 10}], 10 ^ 4];SmoothDensityHistogram[data]Properties & Relations (7)
SmoothDensityHistogram effectively plots the distribution function of SmoothKernelDistribution:
data = RandomVariate[BinormalDistribution[.5], 20];{SmoothDensityHistogram[data, PlotRange -> {{-3, 3}, {-3, 3}}], DensityPlot[PDF[SmoothKernelDistribution[data], {x, y}], {x, -3, 3}, {y, -3, 3}]}Use DensityHistogram to plot the data in discrete bins:
data = RandomVariate[BinormalDistribution[.5], 1000];{DensityHistogram[data, {0.25}, "PDF"], SmoothDensityHistogram[data]}Use SmoothDensityHistogram and SmoothHistogram3D for bivariate data:
data = RandomVariate[BinormalDistribution[{1 / 3, 1 / 2}, {1, 1 / 2}, 0], 100];{SmoothDensityHistogram[data], SmoothHistogram3D[data]}Use SmoothHistogram for univariate data:
data = RandomVariate[NormalDistribution[1, 2], 100];SmoothHistogram[data]Use GeoSmoothHistogram for geographic data:
GeoSmoothHistogram[GeoPosition[{{11.207713008363157, -43.661518392966514}, {-11.056986027169842, -167.87153536942583},
{57.53417889548564, 80.085043575148}, {55.12194165653369, -125.32581239430993},
{-57.05643647882769, -64.40392914774509}, {54.76245516335729, ... 53899593, 105.17839902009905}, {-32.39745053106765, 60.336274063234214},
{68.90336223808907, -118.85888960761503}, {-35.39586484300955, -44.31309282560767},
{77.19783437187914, 49.33663298538454}, {-17.169043915737575, -121.81169791603082}}]]Additional points will result in a better approximation of the underlying distribution:
data = RandomVariate[BinormalDistribution[.5], 10 ^ 5];Table[SmoothDensityHistogram[RandomSample[data, i], PlotLabel -> i], {i, {10, 10 ^ 3, 10 ^ 5}}]As the bandwidth approaches infinity, the estimate approaches the shape of the kernel:
data = {{0, -.5}, {0, 0}, {0, .5}};𝒦 = {"Gaussian", "Epanechnikov", "Biweight", "Triweight", "Rectangular", "Triangular", "Cosine", "SemiCircle"};Table[SmoothDensityHistogram[data, {200, k}, FrameTicks -> None, PlotLabel -> k], {k, 𝒦}]Related Guides
History
Introduced in 2010 (8.0) | Updated in 2014 (10.0) ▪ 2015 (10.2) ▪ 2025 (14.2)
Text
Wolfram Research (2010), SmoothDensityHistogram, Wolfram Language function, https://reference.wolfram.com/language/ref/SmoothDensityHistogram.html (updated 2025).
CMS
Wolfram Language. 2010. "SmoothDensityHistogram." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2025. https://reference.wolfram.com/language/ref/SmoothDensityHistogram.html.
APA
Wolfram Language. (2010). SmoothDensityHistogram. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/SmoothDensityHistogram.html
BibTeX
@misc{reference.wolfram_2026_smoothdensityhistogram, author="Wolfram Research", title="{SmoothDensityHistogram}", year="2025", howpublished="\url{https://reference.wolfram.com/language/ref/SmoothDensityHistogram.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_smoothdensityhistogram, organization={Wolfram Research}, title={SmoothDensityHistogram}, year={2025}, url={https://reference.wolfram.com/language/ref/SmoothDensityHistogram.html}, note=[Accessed: 12-June-2026]}