Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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]]
share|improve this question
    
+1 That's one nice question! –  Sasha Nov 8 '12 at 22:16
add comment

migrated from stackoverflow.com Nov 8 '12 at 22:07

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

1 Answer

up vote 7 down vote accepted

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]
  ]

enter image description here

share|improve this answer
    
Awesome, thanks! –  jfelectron Nov 8 '12 at 23:59
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.