[R] overlapping/interleaved histogram help

Brian Hook hook_l at bookofhook.com
Wed Mar 2 21:56:19 CET 2005


NOTE: I have read the FAQ, Verzani's book, Rtips, and googled.

For various reasons I don't want to use a density plot when comparing 
two distributions, I would prefer to have interleaved histograms over 
the same ranges.

In addition to this, I would also like to normalize the two histograms 
so that both of their max Y values are the same (so I can compare 
relative distributions within one distribution to the relative 
distributions within another, i.e. peaks).  The data is clustered in a 
narrow range with quite a few outliers, and for this reason the 
regular histogram function with default parameters tends to give a 
poor graph (very wide swaths to encompass the outliers), whereas I'd 
prefer a fixed visual size to cover the outliers.

My current instinct is that I will have to do the following:

1.  Take existing data and bin it
2.  Iterate over data and perform optional normalization
3.  Interleave the two data sets
4.  Render with bar plots

If those sounds like the appropriate steps then I'll research it and 
go with that, but I'm hoping there's a much simpler solution.

Thanks,

Brian




More information about the R-help mailing list