I got into trouble while plotting two (very different) 2D histograms on the same canvas. This can be illustrated/reproduced with the following.
Whenever the two histograms have compatible statistics, there is no issue as shown here:
(this plot can be reproduced with multipaletteForVeryDifferentDistributions.cxx, just do
root -l multipaletteForVeryDifferentDistributions.cxx
But when I want these histograms to have very different statistics, for example, by setting
50 (instead of
1e6) in my function above, I get this:
The problem is the bin colors of the top right histogram: pretty much all its bins are filled only once now, which corresponds to deep blue on the bottom left histogram. The two histograms seem to “share” the z-axis scale. What I want is to draw this top right histogram with its own scale, as if the bottom left histogram does not exist:
How do I do that? How to make the second histogram “forget” about the z-axis scale of the first one?
ROOT Version: 6.18/04
Try to use (for both histograms): TH1::DrawNormalized
Thanks, but it does not work as expected, I get this:
Somehow all the bins of the top right histogram are drawn as having the same bin content - that’s not what I want.
If this histogram has only 50 entries which are “randomly” distributed then you see 50 bins (each having contents 1).
No, I showed the “expected” color distribution above (I copy that picture below just in case). Cyan means content = 1, yellow means 2, dark red means 3. I would expect to get exactly the same color distribution.
#if 1 /* 0 or 1 */
bottomLeftHistogram->DrawNormalized("col", bottomLeftHistogram->Integral() / bottomLeftHistogram->GetMaximum());
topRightHistogram->DrawNormalized("same col", topRightHistogram->Integral() / topRightHistogram->GetMaximum());
#else /* 0 or 1 */
bottomLeftHistogram->Scale(1. / bottomLeftHistogram->GetMaximum());
topRightHistogram->Scale(1. / topRightHistogram->GetMaximum());
#endif /* 0 or 1 */
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.