PairedSmoothHistogram[{x1,x2,…},{y1,y2,…}]
plots a paired smooth histogram of the values xi and yi.
PairedSmoothHistogram[{x1,x2,…},{y1,y2,…},espec]
plots a paired smooth histogram with estimator specification espec.
PairedSmoothHistogram[{x1,x2,…},{y1,y2,…},espec,dfun]
plots a paired smooth histogram with distribution function dfun.
PairedSmoothHistogram[{data11,…},{data21,…},…]
plots paired smooth histograms for multiple datasets data1i and data2j.
PairedSmoothHistogram
PairedSmoothHistogram[{x1,x2,…},{y1,y2,…}]
plots a paired smooth histogram of the values xi and yi.
PairedSmoothHistogram[{x1,x2,…},{y1,y2,…},espec]
plots a paired smooth histogram with estimator specification espec.
PairedSmoothHistogram[{x1,x2,…},{y1,y2,…},espec,dfun]
plots a paired smooth histogram with distribution function dfun.
PairedSmoothHistogram[{data11,…},{data21,…},…]
plots paired smooth histograms for multiple datasets data1i and data2j.
Details and Options
- PairedSmoothHistogram[data1,data2] by default plots a paired smooth histogram of the PDF of data1 and data2 using 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.
- 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 - PairedSmoothHistogram[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:
-
col plot values from column col {col1,col2,…,coln} plot columns {col1, …, coln} as a group of values - PairedSmoothHistogram has the same options as Graphics with the following additions and changes: [List of all options]
-
AspectRatio 1/GoldenRatio ratio of width to height Axes True whether to draw axes ClippingStyle None what to draw where curves are clipped ColorFunction Automatic how to determine the coloring of curves ColorFunctionScaling True whether to scale arguments to ColorFunction Filling None filling to insert under each curve FillingStyle Automatic style to use for filling MaxRecursion Automatic the maximum number of recursive subdivisions allowed Mesh None how many mesh points to draw on each curve MeshFunctions {#1&} how to determine the placement of mesh points MeshShading None how to shade regions between mesh points MeshStyle Automatic the style for mesh points Method Automatic methods to use PerformanceGoal $PerformanceGoal aspects of performance to try to optimize PlotPoints Automatic initial number of sample points PlotRange Automatic range of values to include PlotRangeClipping True whether to clip at the plot range PlotStyle Automatic graphics directives to specify the style for each object 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 Spacings Automatic space between plot axes WorkingPrecision MachinePrecision the precision used in internal computations for symbolic distributions - Possible settings for PlotOrigin include "XAxis" and "YAxis".
- Settings for Spacings are in absolute coordinates. A setting of the form Scaled[s] gives spacing that is a fraction s of the graphic.
- The arguments supplied to RegionFunction, MeshFunctions, and ColorFunction are x and f, where f can be the PDF, CDF, etc. of the distribution.
- With ScalingFunctions->{sx,sy}, the
coordinate is scaled using sx and the
coordinate is scaled using sy. -
AlignmentPoint Center the default point in the graphic to align with AspectRatio 1/GoldenRatio ratio of width to height Axes True 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 ClippingStyle None what to draw where curves are clipped ColorFunction Automatic how to determine the coloring of curves ColorFunctionScaling True whether to scale arguments 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 Filling None filling to insert under each curve FillingStyle Automatic style to use for filling FormatType TraditionalForm the default format type for text Frame False whether to put a frame around the plot FrameLabel None frame labels FrameStyle {} style specifications for the frame FrameTicks Automatic frame ticks 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 MaxRecursion Automatic the maximum number of recursive subdivisions allowed Mesh None how many mesh points to draw on each curve MeshFunctions {#1&} how to determine the placement of mesh points MeshShading None how to shade regions between mesh points MeshStyle Automatic the style for mesh points Method Automatic methods to use PerformanceGoal $PerformanceGoal aspects of performance to try to optimize PlotLabel None an overall label for the plot PlotPoints Automatic initial number of sample points PlotRange Automatic range of 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 PlotStyle Automatic graphics directives to specify the style for each object 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 Spacings Automatic space between plot axes Ticks Automatic axes ticks TicksStyle {} style specifications for axes ticks WorkingPrecision MachinePrecision the precision used in internal computations for symbolic distributions
List of all options
Examples
open all close allBasic Examples (2)
Generate a paired smooth histogram of two datasets:
PairedSmoothHistogram[RandomVariate[NormalDistribution[0, 1], 100], RandomVariate[NormalDistribution[1, 1 / 2], 100]]Plot the probability density function of the datasets:
data1 = RandomVariate[NormalDistribution[1, 2], 500];
data2 = RandomVariate[WeibullDistribution[1, 2], 500];PairedSmoothHistogram[data1, data2, Automatic, "PDF"]Cumulative distribution function:
PairedSmoothHistogram[data1, data2, Automatic, "CDF"]PairedSmoothHistogram[data1, data2, Automatic, "SF"]PairedSmoothHistogram[data1, data2, Automatic, "HF"]PairedSmoothHistogram[data1, data2, Automatic, "CHF"]Scope (17)
Data (7)
Plot different distribution functions:
Table[PairedSmoothHistogram[RandomVariate[NormalDistribution[], 1000], RandomVariate[NormalDistribution[], 1000], Automatic, dfun, Filling -> Axis, PlotLabel -> dfun], {dfun, {"PDF", "CDF", "SF", "HF", "CHF"}}]PlotRange is selected automatically:
data1 = RandomVariate[WeibullDistribution[2, 1], 10 ^ 3];
data2 = RandomVariate[WeibullDistribution[2, 1], 10 ^ 3];PairedSmoothHistogram[data1, data2]Use PlotRange to focus on areas of interest:
PairedSmoothHistogram[data1, data2, PlotRange -> {{0, 2}, {0, .5}}, Filling -> Axis]Nonreal data points are ignored:
data1 = {2.0, 1.9, 1.0, 1.1, 0.4, 1.3, 1.2, 0. + 0.5 I, 1., 0. + 0.9 I};
data2 = {2.0, 1.9, 1.0, 1.1, 0.4, 1.3, 1.2, 0. + 0.5 I, 1., 0. + 0.9 I};{PairedSmoothHistogram[data1, data2], PairedSmoothHistogram[Cases[data1, _Real], Cases[data2, _Real]]}Specify the number of times to refine the curve:
PairedSmoothHistogram[RandomVariate[NormalDistribution[], 100], RandomVariate[NormalDistribution[], 100], MaxRecursion -> 0]data1 = RandomVariate[NormalDistribution[2, 1], 10];
data2 = RandomVariate[NormalDistribution[2, 1], 10];PairedSmoothHistogram[Style[data1, Dashed, Thick, RGBColor[0.93, 0.27, 0.27]], Style[data2, Dashed, Thick]]Override the default tooltips:
data1 = RandomVariate[NormalDistribution[2, 1], 10 ^ 3];
data2 = RandomVariate[NormalDistribution[2, 1], 10 ^ 3];PairedSmoothHistogram[Tooltip[data1, "normal distribution"], Tooltip[data2, "normal distribution"]]Use any object in the tooltip:
PairedSmoothHistogram[Tooltip[data1, BoxWhiskerChart[data1]], Tooltip[data2, BoxWhiskerChart[data2]]]Use PopupWindow to provide additional drilldown information:
data1 = RandomVariate[NormalDistribution[2, 1], 10 ^ 3];
data2 = RandomVariate[NormalDistribution[2, 1], 10 ^ 3];PairedSmoothHistogram[PopupWindow[data1, Histogram[data1]], PopupWindow[data1, Histogram[data2]]]Tabular Data (2)
cars = ResourceData["Sample Tabular Data: Fuel Economy"]Compare the distribution of cars' miles per gallon consumption between city and highway:
PairedSmoothHistogram[cars -> "city", cars -> "hwy"]Pivot the data to have columns distinguishing mileage for cars with different numbers of cylinders:
pivot = PivotToColumns[cars, "cyl" -> {"city", "hwy"}]Compare city and highway mileage between 4- and 6-cylinder cars:
PairedSmoothHistogram[pivot -> {ExtendedKey["city", 4], ExtendedKey["city", 6]}, pivot -> {ExtendedKey["hwy", 4], ExtendedKey["hwy", 6]}, PlotLegends -> {"4 cyl", "6 cyl"}]Presentation (8)
Multiple datasets are automatically colored to be distinct:
data = Table[RandomVariate[NormalDistribution[c, 1], 500], {c, 4}];PairedSmoothHistogram[data, data]Provide explicit styling to different sets:
data = Table[RandomVariate[NormalDistribution[c, 1], 500], {c, 4}];PairedSmoothHistogram[data, data, PlotStyle -> {RGBColor[0.93, 0.27, 0.27], RGBColor[0.98, 0.56, 0.17], RGBColor[0.4, 0.6, 1], RGBColor[0.8, 0.3, 0.8]}]PairedSmoothHistogram[RandomVariate[WeibullDistribution[2, 1], 10 ^ 4], RandomVariate[WeibullDistribution[2, 1], 10 ^ 4], AxesLabel -> {"x", "pdf"}, PlotLabel -> "Weibull Distribution", PlotStyle -> Directive[Thick, RGBColor[0.8, 0.3, 0.8]], Filling -> Axis]Use the default tooltip for the data:
data1 = RandomVariate[NormalDistribution[2, 1], 500];
data2 = RandomVariate[WeibullDistribution[2, 1], 500];PairedSmoothHistogram[Tooltip[data1], Tooltip[data2]]Provide an interactive tooltip for the data:
data1 = RandomVariate[NormalDistribution[2, 1], 500];
data2 = RandomVariate[WeibullDistribution[2, 1], 500];PairedSmoothHistogram[Tooltip[data1, BoxWhiskerChart[data1]], Tooltip[data2, BoxWhiskerChart[data2]]]data1 = RandomVariate[NormalDistribution[2, 1], 500];
data2 = RandomVariate[WeibullDistribution[2, 1], 500];PairedSmoothHistogram[{data1, data2}, {data1, data2}, Filling -> {1 -> {{2}, {RGBColor[0.93, 0.27, 0.27], RGBColor[0.4, 0.6, 1]}}}]PairedSmoothHistogram[RandomVariate[NormalDistribution[0, 1], 100], RandomVariate[NormalDistribution[0, 1], 100], Mesh -> 10, Frame -> True, Axes -> False]Style the curve segments between mesh points:
PairedSmoothHistogram[RandomVariate[NormalDistribution[0, 1], 100], RandomVariate[NormalDistribution[0, 1], 100], Mesh -> 10, MeshShading -> {RGBColor[0.93, 0.27, 0.27], RGBColor[0.4, 0.6, 1]}, Frame -> True, Axes -> False]Options (66)
AspectRatio (2)
Choose the ratio of height to width from the actual plot values:
PairedSmoothHistogram[RandomVariate[NormalDistribution[], 100], RandomVariate[NormalDistribution[], 100], AspectRatio -> Automatic]Scale the graphic so that the height and width are the same:
PairedSmoothHistogram[RandomVariate[NormalDistribution[], 100], RandomVariate[NormalDistribution[], 100], AspectRatio -> 1]Axes (3)
PairedSmoothHistogram[RandomVariate[NormalDistribution[], 100], RandomVariate[NormalDistribution[], 100]]Use AxesFalse to turn off axes:
PairedSmoothHistogram[RandomVariate[NormalDistribution[], 100], RandomVariate[NormalDistribution[], 100], Axes -> False]Turn each axis on individually:
{PairedSmoothHistogram[RandomVariate[NormalDistribution[], 100], RandomVariate[NormalDistribution[], 100], Axes -> {False, True}], PairedSmoothHistogram[RandomVariate[NormalDistribution[], 100], RandomVariate[NormalDistribution[], 100], Axes -> {True, False}]}AxesStyle (4)
Change the style for the axes:
PairedSmoothHistogram[RandomVariate[NormalDistribution[], 100], RandomVariate[NormalDistribution[], 100], AxesStyle -> RGBColor[0.93, 0.27, 0.27]]Specify the style of each axis:
PairedSmoothHistogram[RandomVariate[NormalDistribution[], 100], RandomVariate[NormalDistribution[], 100], AxesStyle -> {{Thick, RGBColor[0.93, 0.27, 0.27]}, {Thick, RGBColor[0.14, 0.8, 0.14]}}]Use different styles for the ticks and the axes:
PairedSmoothHistogram[RandomVariate[NormalDistribution[], 100], RandomVariate[NormalDistribution[], 100], AxesStyle -> RGBColor[0.14, 0.8, 0.14], TicksStyle -> RGBColor[0.95, 0.43, 0.96]]Use different styles for the labels and the axes:
PairedSmoothHistogram[RandomVariate[NormalDistribution[], 100], RandomVariate[NormalDistribution[], 100], AxesStyle -> RGBColor[0.14, 0.8, 0.14], LabelStyle -> RGBColor[0.95, 0.43, 0.96]]ClippingStyle (4)
Omit clipped regions of the plot:
PairedSmoothHistogram[Range[0, 1, 0.01], Range[0, 1, 0.01], Automatic, "HF"]Show the clipped regions like the rest of the curve:
PairedSmoothHistogram[Range[0, 1, 0.01], Range[0, 1, 0.01], Automatic, "HF", ClippingStyle -> Automatic, PlotStyle -> Thick]Show the clipped regions with red lines:
PairedSmoothHistogram[Range[0, 1, 0.01], Range[0, 1, 0.01], Automatic, "HF", ClippingStyle -> RGBColor[0.93, 0.27, 0.27]]Show the clipped regions as red and thick:
PairedSmoothHistogram[Range[0, 1, 0.01], Range[0, 1, 0.01], Automatic, "HF", ClippingStyle -> Directive[RGBColor[0.93, 0.27, 0.27], Thick]]ColorFunction (5)
Color by scaled
and
coordinates:
Table[PairedSmoothHistogram[RandomVariate[NormalDistribution[], 100], RandomVariate[NormalDistribution[], 100], ColorFunction -> f, PlotLabel -> f, PlotStyle -> Thick], {f, {Function[{x, y}, Hue[x]], Function[{x, y}, Hue[y]]}}]Color with a named color scheme:
PairedSmoothHistogram[RandomVariate[NormalDistribution[], 100], RandomVariate[NormalDistribution[], 100], ColorFunction -> "DarkRainbow"]Fill with the color used for the curve:
PairedSmoothHistogram[RandomVariate[NormalDistribution[1, 2], 100], RandomVariate[NormalDistribution[1, 2], 100], ColorFunction -> Function[{x, y}, Hue[x]], Filling -> Axis]ColorFunction has higher priority than PlotStyle for coloring the curve:
PairedSmoothHistogram[RandomVariate[NormalDistribution[1, 2], 100], RandomVariate[NormalDistribution[1, 3], 100], ColorFunction -> "DarkRainbow", PlotStyle -> Directive[Red, Thick]]Use Automatic in MeshShading to use ColorFunction:
PairedSmoothHistogram[RandomVariate[NormalDistribution[1, 2], 100], RandomVariate[NormalDistribution[1, 4], 100], ColorFunction -> "Rainbow", PlotStyle -> Directive[RGBColor[1, 0, 0], Thick], Mesh -> 9, MeshShading -> {Automatic, GrayLevel[0.62]}, MeshStyle -> None]ColorFunctionScaling (2)
Color the line based on scaled
value:
PairedSmoothHistogram[RandomVariate[NormalDistribution[], 100], RandomVariate[NormalDistribution[], 100], ColorFunction -> Function[{x, y}, Hue[y]], PlotStyle -> Thick, ColorFunctionScaling -> True]Color the line based on unscaled
value:
PairedSmoothHistogram[RandomVariate[NormalDistribution[], 100], RandomVariate[NormalDistribution[], 100], ColorFunction -> Function[{x, y}, Hue[y]], PlotStyle -> Thick, ColorFunctionScaling -> False]Filling (6)
Use symbolic or explicit values:
Table[PairedSmoothHistogram[Range[-2, 2, 0.05], Range[-2, 2, 0.05], Filling -> c, PlotLabel -> c], {c, {Top, Bottom, Axis, 0.1}}]By default, overlapping fills combine using opacity:
PairedSmoothHistogram[{RandomVariate[NormalDistribution[], 14], RandomVariate[PoissonDistribution[1], 10]}, {RandomVariate[NormalDistribution[], 14], RandomVariate[PoissonDistribution[1], 10]}, Filling -> Axis]Fill between curve 1 and the
axis:
PairedSmoothHistogram[{RandomVariate[NormalDistribution[], 14], RandomVariate[PoissonDistribution[1], 10]}, {RandomVariate[NormalDistribution[], 14], RandomVariate[PoissonDistribution[1], 10]}, Filling -> {1 -> Axis}]PairedSmoothHistogram[{RandomVariate[NormalDistribution[], 14], RandomVariate[PoissonDistribution[1], 10]}, {RandomVariate[NormalDistribution[], 14], RandomVariate[PoissonDistribution[1], 10]}, Filling -> {1 -> {2}}]Fill between datasets using a particular style:
PairedSmoothHistogram[{RandomVariate[NormalDistribution[], 14], RandomVariate[PoissonDistribution[1], 10]}, {RandomVariate[NormalDistribution[], 14], RandomVariate[PoissonDistribution[1], 10]}, Filling -> {1 -> {{2}, Directive[RGBColor[0.98, 0.56, 0.17], Opacity[.6]]}}]Use different styles above and below the filling level:
PairedSmoothHistogram[{RandomVariate[NormalDistribution[], 14], RandomVariate[PoissonDistribution[1], 10]}, {RandomVariate[NormalDistribution[], 14], RandomVariate[PoissonDistribution[1], 10]}, Filling -> {1 -> {{2}, {Yellow, Red}}}]FillingStyle (4)
Table[PairedSmoothHistogram[RandomReal[NormalDistribution[1, 10], 100], RandomReal[NormalDistribution[1, 10], 100], Filling -> Bottom, FillingStyle -> c], {c, {RGBColor[0.93, 0.27, 0.27], RGBColor[0.14, 0.8, 0.14], RGBColor[0.4, 0.6, 1], RGBColor[1, 0.75, 0]}}]PairedSmoothHistogram[Sequence@@Table[{RandomVariate[NormalDistribution[x, 2x], 100], RandomVariate[NormalDistribution[x, 2x], 100]}, {x, 1, 2}], Filling -> Bottom, FillingStyle -> Directive[Opacity[0.5], RGBColor[0.98, 0.56, 0.17]]]Fill with red when the first curve is below the second, and blue when the second is below the first:
PairedSmoothHistogram[Sequence@@Table[{RandomVariate[NormalDistribution[x, 2x], 100], RandomVariate[NormalDistribution[x, 2x], 100]}, {x, 1, 2}], Filling -> {1 -> {2}}, FillingStyle -> {RGBColor[0.93, 0.27, 0.27], RGBColor[0.4, 0.6, 1]}]Use a variable filling style obtained from a ColorFunction:
PairedSmoothHistogram[RandomReal[NormalDistribution[1, 10], 100], RandomReal[NormalDistribution[1, 10], 100], ColorFunction -> Function[{x, y}, Hue[y]], Filling -> Axis, FillingStyle -> Automatic]ImageSize (7)
Use named sizes such as Tiny, Small, Medium and Large:
{PairedSmoothHistogram[RandomVariate[NormalDistribution[], 100], RandomVariate[NormalDistribution[], 100], ImageSize -> Tiny], PairedSmoothHistogram[RandomVariate[NormalDistribution[], 100], RandomVariate[NormalDistribution[], 100], ImageSize -> Small]}Specify the width of the plot:
{PairedSmoothHistogram[RandomVariate[NormalDistribution[], 100], RandomVariate[NormalDistribution[], 100], ImageSize -> 150], PairedSmoothHistogram[RandomVariate[NormalDistribution[], 100], RandomVariate[NormalDistribution[], 100], AspectRatio -> 1.5, ImageSize -> 150]}Specify the height of the plot:
{PairedSmoothHistogram[RandomVariate[NormalDistribution[], 100], RandomVariate[NormalDistribution[], 100], ImageSize -> {Automatic, 150}], PairedSmoothHistogram[RandomVariate[NormalDistribution[], 100], RandomVariate[NormalDistribution[], 100], AspectRatio -> 2, ImageSize -> {Automatic, 150}]}Allow the width and height to be up to a certain size:
{PairedSmoothHistogram[RandomVariate[NormalDistribution[], 100], RandomVariate[NormalDistribution[], 100], ImageSize -> UpTo[200]], PairedSmoothHistogram[RandomVariate[NormalDistribution[], 100], RandomVariate[NormalDistribution[], 100], AspectRatio -> 2, ImageSize -> UpTo[200]]}Specify the width and height for a graphic, padding with space if necessary:
PairedSmoothHistogram[RandomVariate[NormalDistribution[], 100], RandomVariate[NormalDistribution[], 100], ImageSize -> {200, 200}, Background -> RGBColor[1, 0.75, 0]]Setting AspectRatioFull will fill the available space:
PairedSmoothHistogram[RandomVariate[NormalDistribution[], 100], RandomVariate[NormalDistribution[], 100], AspectRatio -> Full, ImageSize -> {200, 200}, Background -> RGBColor[1, 0.75, 0]]Use maximum sizes for the width and height:
{PairedSmoothHistogram[RandomVariate[NormalDistribution[], 100], RandomVariate[NormalDistribution[], 100], ImageSize -> {UpTo[150], UpTo[100]}], PairedSmoothHistogram[RandomVariate[NormalDistribution[], 100], RandomVariate[NormalDistribution[], 100], AspectRatio -> 2, ImageSize -> {UpTo[150], UpTo[100]}]}Use ImageSizeFull to fill the available space in an object:
Framed[Pane[PairedSmoothHistogram[RandomVariate[NormalDistribution[], 100], RandomVariate[NormalDistribution[], 100], ImageSize -> Full, Background -> RGBColor[1, 0.75, 0]], {200, 100}]]Specify the image size as a fraction of the available space:
Framed[Pane[PairedSmoothHistogram[RandomVariate[NormalDistribution[], 100], RandomVariate[NormalDistribution[], 100], AspectRatio -> Full, ImageSize -> {Scaled[0.5], Scaled[0.5]}, Background -> RGBColor[1, 0.75, 0]], {200, 200}]]MaxRecursion (2)
PairedSmoothHistogram[RandomVariate[NormalDistribution[1, 10], 100], RandomVariate[NormalDistribution[1, 10], 100], Mesh -> All, MeshStyle -> PointSize[Small]]Each level of MaxRecursion will subdivide the initial mesh into a finer mesh:
Table[PairedSmoothHistogram[RandomVariate[NormalDistribution[1, 10], 100], RandomVariate[NormalDistribution[1, 10], 100], MaxRecursion -> i, Mesh -> All, Ticks -> None, MeshStyle -> PointSize[Small]], {i, {0, 3, 6}}]Mesh (3)
Use 20 mesh levels evenly spaced in the
direction:
PairedSmoothHistogram[RandomVariate[NormalDistribution[], 100], RandomVariate[NormalDistribution[], 100], Mesh -> 20, MeshStyle -> PointSize[Medium]]Use an explicit list of values for the mesh in the
direction:
data = RandomVariate[UniformDistribution[{1, 10}], 100];PairedSmoothHistogram[data, data, Mesh -> {Range[0, 12, 2]}, MeshStyle -> PointSize[Medium]]Specify mesh levels and styles in the
direction:
data = RandomVariate[UniformDistribution[{1, 10}], 100];PairedSmoothHistogram[data, data, Mesh -> {Table[{x, Hue[x / (2)]}, {x, 0., 12, .5}]}]MeshFunctions (2)
Use a mesh evenly spaced in the
and
directions:
Table[PairedSmoothHistogram[RandomVariate[NormalDistribution[1, 10], 100], RandomVariate[NormalDistribution[1, 10], 100], MeshFunctions -> {Function[{x, y}, Evaluate[f]]}, Mesh -> 9, PlotLabel -> f, MeshStyle -> PointSize[Medium]], {f, {x, y}}]Show 5 mesh levels in the
direction (red) and 10 in the
direction (blue):
PairedSmoothHistogram[RandomVariate[NormalDistribution[1, 10], 100], RandomVariate[NormalDistribution[1, 10], 100], Mesh -> {5, 10}, MeshFunctions -> {#1&, #2&}, MeshStyle -> {Directive[PointSize[Medium], RGBColor[0.93, 0.27, 0.27]], RGBColor[0.4, 0.6, 1]}]MeshShading (6)
Alternate red and blue segments of equal width in the
direction:
PairedSmoothHistogram[RandomVariate[NormalDistribution[], 100], RandomVariate[NormalDistribution[], 100], Mesh -> 10, MeshShading -> {RGBColor[0.93, 0.27, 0.27], RGBColor[0.4, 0.6, 1]}, MeshStyle -> PointSize[Medium]]Use None to remove segments:
PairedSmoothHistogram[RandomVariate[NormalDistribution[], 100], RandomVariate[NormalDistribution[], 100], Mesh -> 10, MeshShading -> {RGBColor[0.93, 0.27, 0.27], None}, MeshStyle -> PointSize[Medium]]MeshShading can be used with PlotStyle:
PairedSmoothHistogram[RandomVariate[NormalDistribution[], 100], RandomVariate[NormalDistribution[], 100], Mesh -> 10, PlotStyle -> Thick, MeshFunctions -> {#1&}, MeshShading -> {RGBColor[0.93, 0.27, 0.27], RGBColor[0.4, 0.6, 1]}, MeshStyle -> PointSize[Medium]]MeshShading has higher priority than PlotStyle for styling the curve:
PairedSmoothHistogram[RandomVariate[NormalDistribution[], 100], RandomVariate[NormalDistribution[], 100], Mesh -> 10, PlotStyle -> RGBColor[0.14, 0.8, 0.14], MeshFunctions -> {#1&}, MeshShading -> {RGBColor[0.93, 0.27, 0.27], RGBColor[0.4, 0.6, 1]}, MeshStyle -> PointSize[Medium]]Use PlotStyle for some segments by setting MeshShading to Automatic:
PairedSmoothHistogram[RandomVariate[NormalDistribution[], 100], RandomVariate[NormalDistribution[], 100], Mesh -> 10, PlotStyle -> Directive[Thick, RGBColor[1, 0.75, 0]], MeshFunctions -> {#1&}, MeshShading -> {RGBColor[0.93, 0.27, 0.27], Automatic}]MeshShading can be used with ColorFunction:
PairedSmoothHistogram[RandomVariate[NormalDistribution[], 100], RandomVariate[NormalDistribution[], 100], Mesh -> 10, PlotStyle -> Thick, MeshFunctions -> {#1&}, MeshShading -> {GrayLevel[0.62], Automatic},
ColorFunction -> Function[{x, y}, Hue[x]], MeshStyle -> PointSize[Medium]]MeshStyle (4)
Color the mesh the same color as the plot:
PairedSmoothHistogram[RandomVariate[NormalDistribution[], 100], RandomVariate[NormalDistribution[], 100], Mesh -> 9, MeshStyle -> PointSize[Medium]]Use a red mesh in the
direction:
PairedSmoothHistogram[RandomVariate[NormalDistribution[], 100], RandomVariate[NormalDistribution[], 100], Mesh -> 9, MeshStyle -> Directive[RGBColor[0.93, 0.27, 0.27], PointSize[Medium]]]Use a red mesh in the
direction and a blue mesh in the
direction:
PairedSmoothHistogram[RandomVariate[NormalDistribution[], 100], RandomVariate[NormalDistribution[], 100], Mesh -> 9, MeshStyle -> {Directive[RGBColor[0.93, 0.27, 0.27], PointSize[Medium]], Directive[RGBColor[0.4, 0.6, 1], PointSize[Medium]]}, MeshFunctions -> {#1&, #2&}]Use big, red mesh points in the
direction:
PairedSmoothHistogram[RandomVariate[NormalDistribution[], 100], RandomVariate[NormalDistribution[], 100], Mesh -> 10, MeshStyle -> Directive[PointSize[Large], RGBColor[0.93, 0.27, 0.27]]]PerformanceGoal (2)
Generate a higher-quality plot:
Timing[PairedSmoothHistogram[RandomVariate[NormalDistribution[], 100], RandomVariate[NormalDistribution[], 100], PerformanceGoal -> "Quality"]]Emphasize performance, possibly at the cost of quality:
Timing[PairedSmoothHistogram[RandomVariate[NormalDistribution[], 100], RandomVariate[NormalDistribution[], 100], PerformanceGoal -> "Speed"]]PlotPoints (1)
PlotRange (2)
PlotRange is automatically calculated:
data = RandomVariate[WeibullDistribution[2, 4], 100];PairedSmoothHistogram[data, data, Automatic, "HF"]PairedSmoothHistogram[data, data, Automatic, "HF", PlotRange -> All]SmoothHistogram automatically chooses the plotting domain:
data = RandomVariate[ExponentialDistribution[1], 500];PairedSmoothHistogram[data, data]Plot over the middle 90% of the data:
PairedSmoothHistogram[data, data, PlotRange -> {Quantile[data, {0.05, 0.95}], All}]PlotStyle (6)
Use different style directives:
Table[PairedSmoothHistogram[RandomVariate[ExponentialDistribution[1 / 2], 500], RandomVariate[ExponentialDistribution[1 / 2], 500], PlotStyle -> ps], {ps, {RGBColor[0.93, 0.27, 0.27], Thick, Dashed, Directive[RGBColor[0.93, 0.27, 0.27], Thick]}}]By default, different styles are chosen for multiple curves:
PairedSmoothHistogram[Table[RandomVariate[ExponentialDistribution[x], 100], {x, 1, 4, 1}], Table[RandomVariate[ExponentialDistribution[x], 100], {x, 1, 4, 1}]]Explicitly specify the style for different curves:
PairedSmoothHistogram[Table[RandomVariate[ExponentialDistribution[x], 100], {x, 1, 4, 1}], Table[RandomVariate[ExponentialDistribution[x], 100], {x, 1, 4, 1}], PlotStyle -> {RGBColor[0.93, 0.27, 0.27], RGBColor[0.14, 0.8, 0.14], RGBColor[0.4, 0.6, 1], RGBColor[0.67, 0.54, 0.42]}]PlotStyle can be combined with ColorFunction:
PairedSmoothHistogram[RandomVariate[ExponentialDistribution[1 / 2], 500], RandomVariate[ExponentialDistribution[1 / 2], 500], PlotStyle -> Thick, ColorFunction -> Function[{x, y}, Hue[y]]]PlotStyle can be combined with MeshShading:
PairedSmoothHistogram[RandomVariate[ExponentialDistribution[1 / 2], 500], RandomVariate[ExponentialDistribution[1 / 2], 500], PlotStyle -> Directive[Opacity[0.5], Thick], Mesh -> 10, MeshFunctions -> {#1&}, MeshShading -> {RGBColor[0.93, 0.27, 0.27], RGBColor[0.4, 0.6, 1]}]MeshStyle by default uses the same style as PlotStyle:
PairedSmoothHistogram[RandomVariate[ExponentialDistribution[1 / 2], 500], RandomVariate[ExponentialDistribution[1 / 2], 500], PlotStyle -> RGBColor[0.93, 0.27, 0.27], Mesh -> All]Applications (2)
Compare two time slices for a random process:
{data1, data2} = {RandomVariate[WienerProcess[][1], 10 ^ 3], RandomVariate[WienerProcess[][10], 10 ^ 3]};PairedSmoothHistogram[data1, data2, Filling -> Axis]Compare two time slices of TemporalData:
td = RandomFunction[WienerProcess[], {0, 1, .01}, 10 ^ 3]PairedSmoothHistogram[td["SliceData", .3], td["SliceData", .6], Filling -> Axis]Properties & Relations (1)
PairedSmoothHistogram ignores time stamps of TimeSeries and EventSeries:
data1 = TemporalData[EventSeries, {{{0.20242479245467548, 0.2704846026026855, -1.6385644709860396,
-1.269562930257016, -0.6100833227170088, -0.3098890335697966, 0.5452140701120742,
0.33739124140964166, 0.6108178119757203, -0.8185766713897115, -0. ... 6778892896903, 1.3176959856031774, 0.03477397109856467, 0.6980573801933982,
0.7782710526039773, 0.16449547627605665}}, {{0, 100, 1}}, 1, {"Continuous", 1},
{"Discrete", 1}, 1, {ResamplingMethod -> None, ValueDimensions -> 1}}, False, 10.1];data2 = TemporalData[TimeSeries, {{{0.9979943072760531, 0.39944401634462684, -0.8370629804097509,
-0.8601512257464574, 0.6418925883943911, -0.254757753949575, 1.0216002938860733,
0.5729923442123097, -0.2201437893681994, 0.05117351007328737, 2.085 ... 5288584762, 1.3955322599855737, -0.5177183168166122, -0.0662513207420091,
-0.22682713030227636, -0.3354522176887315}}, {{0, 100, 1}}, 1, {"Continuous", 1},
{"Discrete", 1}, 1, {ValueDimensions -> 1, ResamplingMethod -> None}}, False, 10.1];PairedSmoothHistogram[data1, data2]Create a histogram for the values only:
PairedSmoothHistogram[data1["Values"], data2["Values"]]Related Guides
History
Introduced in 2012 (9.0) | Updated in 2014 (10.0) ▪ 2015 (10.2) ▪ 2025 (14.2)
Text
Wolfram Research (2012), PairedSmoothHistogram, Wolfram Language function, https://reference.wolfram.com/language/ref/PairedSmoothHistogram.html (updated 2025).
CMS
Wolfram Language. 2012. "PairedSmoothHistogram." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2025. https://reference.wolfram.com/language/ref/PairedSmoothHistogram.html.
APA
Wolfram Language. (2012). PairedSmoothHistogram. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/PairedSmoothHistogram.html
BibTeX
@misc{reference.wolfram_2026_pairedsmoothhistogram, author="Wolfram Research", title="{PairedSmoothHistogram}", year="2025", howpublished="\url{https://reference.wolfram.com/language/ref/PairedSmoothHistogram.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_pairedsmoothhistogram, organization={Wolfram Research}, title={PairedSmoothHistogram}, year={2025}, url={https://reference.wolfram.com/language/ref/PairedSmoothHistogram.html}, note=[Accessed: 13-June-2026]}