plots a paired histogram of the values xi and yi.

PairedHistogram[{x1,x2,},{y1,y2,}, bspec]

plots a paired histogram with bin width specification bspec.


plots a paired histogram with bin heights computed according to the specification hspec.


plots paired histograms for multiple datasets data1i and data2j.

Details and Options

  • PairedHistogram[data1,data2] by default plots a paired histogram with equal bin widths chosen to approximate an assumed underlying smooth distribution of the values xi and yi.
  • Data for PairedHistogram can be given in the following forms:
  • {e1,e2,}list of elements with or without wrappers
    <|k1y1,k2y2,|>association of keys and lengths
    TimeSeries[],EventSeries[],TemporalData[]time series, event series, and temporal data
    WeightedData[],EventData[]augmented datasets
    w[{e1,e2,},]wrapper applied to a whole dataset
    w[{data1,data1,},]wrapper applied to all datasets
  • 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 xmin to xmax
    {{b1,b2,}}use the bins [b1,b2),[b2,b3),
    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 {b1,b2,}
  • The binning specification "Log" 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 PairedHistogram[data1,data2,fb] is applied to a list of all xi and yi and should return an explicit bin list {b1,b2,}.
  • Different forms of histogram can be obtained by giving different bin height specifications hspec in PairedHistogram[data1,data2,bspec,hspec]. The following forms can be used:
  • "Count"number of elements in each bin
    "CumulativeCount"cumulative counts
    "SurvivalCount"survival counts
    "Probability"fraction of values lying in each bin
    "Intensity"count divided by bin width
    "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 PairedHistogram[data1,data2,bspec,fh] is applied to two arguments: a list of bins {{b1,b2},{b2,b3},} and corresponding list of counts {c1,c2,}. The function should return a list of heights to be used for each of the ci.
  • Only values xi that are real numbers are assigned to bins; others are taken to be missing.
  • In PairedHistogram[{data11,},{data21,},], automatic bin locations are determined by combining all the datasets data1i and data2j.
  • PairedHistogram[{,wi[datai,],},{,wj[dataj],},] renders the histogram elements associated with dataset datak according to the specification defined by the symbolic wrapper wk.
  • Possible symbolic wrappers are the same as for BarChart and include Style, Labeled, Legended, etc.
  • PairedHistogram has the same options as Graphics, with the following additions and changes:
  • 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
    ChartLegendsNonelegends for data elements and datasets
    ChartStyleAutomaticstyle for bars
    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
    PlotTheme$PlotThemeoverall theme for the histogram
    ScalingFunctionsNonehow to scale individual coordinates
    TargetUnitsAutomaticunits to display in the chart
  • Possible settings for ChartLayout include "Overlapped" and "Stacked".
  • The arguments supplied to ChartElementFunction are the bin region {{xmin,xmax},{ymin,ymax}}, the bin values lists, and metadata {m1,m2,} from each level in a nested list of datasets.
  • A list of built-in settings for ChartElementFunction can be obtained from ChartElementData["PairedHistogram"].
  • The argument supplied to ColorFunction is the height for each bin.
  • With ScalingFunctions->{sx,sy}, the x coordinate is scaled using sx etc.
  • Style and other specifications from options and other constructs in BarChart are effectively applied in the order ChartStyle, ColorFunction, Style and other wrappers, ChartElements, and ChartElementFunction, with later specifications overriding earlier ones.


open all close all

Basic Examples  (2)

Generate a paired histogram of two datasets:

Click for copyable input

Plot the probability density function of the datasets:

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

Scope  (23)

Options  (46)

Applications  (3)

Properties & Relations  (5)

Introduced in 2010
Updated in 2015