TH2F "box sames" problem


I have a problem. Let us assume I have 3 root files - 1.root, 2.root, 3.root.
I take some histogram (h1 of TH2F) from 1.root, then take h2 from 2.root and draw them with option “boxsames”, each with different color. That’s OK. But then I take histogram h1 from 1.root (another one time, no connections between them - I do it in different scripts) and h3 from 3.root and do the same - draw these two with option “boxsames”. And here is the problem: the view of h1 should be the same in first and in the second case; any differences are due to whether I have h2 or h3 on the pad. But what I see the view of h1 is different in those cases!

After intense searching your site here I found possible explanation:

(As I can see it also concerns option “SAMES”, not only “SAME”)
OK, but what if I want to compare these 2 histograms: (h1+h2) and (h1+h3)? Of course I understand that h1’s content is the same, but it always looks different (like there are less or more boxes there) despite of exact similarity of stat boxes.

Any ideas? Maybe there is a way to somehow override this “previous plot taking into account”?

All histograms are TH2F.
ROOT version - 5.22

make sure that (h1+h2) and (h1+h3) have the same maximum and minimum.
You can change max and min using SetMaximum(0 and SetMinimum()
Note that it would be exactly the same thing if you would like to compare two histograms having different max and min. To compare them with BOX or COL option hey need to have the same dynamic.

[quote=“couet”]make sure that (h1+h2) and (h1+h3) have the same maximum and minimum.
You can change max and min using SetMaximum() and SetMinimum()

Should it work if I will make


assuming that I no doubt have some names for (h1+h2) and (h1+h3)? Or I am obliged to use SetMaximum() and SetMinimum()?

This is the bin content which matters. So yes, you should make sure the zmin and zmax values are the same.