I am trying to display two different datasets as histograms on the same Canvas and have the TPaveStats object that is created display the stats for each dataset. I know that if you do: hist2.Draw(“sames”) it is supposed to draw in another stat box for the 2nd histogram however when I do this I am getting the exact same stats as the first one that is generated. I know there have been a few topics about this but I have tried their suggestions and nothing has worked, I am trying just a simple example currently. Any suggestions are very appreciated!
TEST_EASY_EXAMPLE.py (1.3 KB)
Platform: MacOS Monterey 12.6.6
the problem is that your second TPaveStats object sits right on top of the first one, so you need to move this second TPaveStats object away from the first one.
This example shows how to move stats.
Hello, I know that they are located one on top of another and I know how to move them initially but the problem is that they display the same stats when they shouldn’t as they are two different datasets.
Could you please send a screenshot indicative of the issue? Here is what I get with your code (after having moved the stat boxes and the legend around):
Hello, after I move the stat boxes just to make sure they aren’t overlapping I see this:
(I know the legend is overlapped currently, if that is the issue that would be interesting to know.)
UPDATE: Interstingly, moving around to make it easier to look at, if I just save the Canvas as a .png directly I get this:
but when I look in root TBrowser I get this:
Did you use the example I sent you ?
From what I could understand of the stats box moving yes but I am not defining separate pads and displaying them on different pads so I don’t know if I need to do that or not as I don’t have different scales to use. Also I still don’t understand why it would work if I save the canvas immediately as a .png but not as a root file.
Yes, in this example you should use the stats moving part only. ie these two lines:
TPaveStats *ps2 = (TPaveStats*)h2->GetListOfFunctions()->FindObject("stats");
Yes when I do that, I get the result as above, where when I launch it in TBrowser the stat boxes are incorrect but if I save it directly as any file extension type, it is populated correctly.