I am plotting two histograms on top of one another (using matplotlib, but that is tangential to my question). My current approach is to compute the mean of the optimal bin widths for each histogram according to the Freedman-Diaconis rule (for the purposes of this question, I am neglecting the possibility of variable bin widths and different bin widths for each histogram).
Is this a theoretically robust thing to do, considering that I am trying to automate the plotting of a large number of histograms with varying shapes (let's say some are approximately Gaussian, some approximately uniform, some have a sharp spike around a certain value and some outliers)? I can't seem to find any simple theoretical answer on how to optimise binning simultaneously for two histograms, so for now I have made a crude pragmatic compromise, and would like to know if anyone knows of a more rigorous approach.