# Overlay of pdf using PairedHistogram in Mathematica

With a standard 1D histogram, I can generate a pdf overlay using Show and Plot.

I'd like to do something similar with PairedHistogram. I can't find any examples. I have tried using Epilog, but I can't figure out how to pass the graphics primitive correctly such that they are matched to the correct histogram.

I'd like to add overlays to the below, with an overlay specified for each histogram in the pair.

PairedHistogram[data[[18]],data[[22]],Automatic,"PDF",
ChartStyle->{{LightOrange,LightBlue},None,None},
ChartLegends->Placed[{names[[18]],names[[22]]},Top]]

-

## migrated from stackoverflow.comNov 8 '12 at 22:07

This question came from our site for professional and enthusiast programmers.

+1 That's one nice question! –  Sasha Nov 8 '12 at 22:16

It's not beautiful, but you can use ParametricPlot adjusted by the BarSpacing to accomplish this.

With[{bs = .1},
Show[PairedHistogram[
RandomVariate[NormalDistribution[], 100],
RandomVariate[UniformDistribution[{-3, 3}], 1000],
Automatic, "PDF", ChartStyle -> {{LightOrange, LightBlue}, None, None},
BarSpacing -> bs],

ParametricPlot[{PDF[UniformDistribution[{-3, 3}], t] + bs/2, t},
{t, -3, 3}, Axes -> None],
ParametricPlot[{-PDF[NormalDistribution[], t] - bs/2, t},
{t, -3, 3}, Axes -> None], PlotRange -> All]
]


-
Awesome, thanks! –  jfelectron Nov 8 '12 at 23:59