I’m a beginner in root. I have a problem. I am creating a tree, once I have filled in I plot a TH1F with one of the branches of the tree, and then I plot a TH2F with the same branch and another one. But once the TH2F is plotted the TH1F disappears. So, I think that I am overwriting it, but i don’t know how to solve the problem.
each time you do that a new plot will be created.
If there is not graphics window open (TCanvas) it will create one.
If there is one already open it will use it and overwrite the plot on it.
There is several to keep the previous plot.
You can create a TCanvas and Divide it
You can Create a new TCanvas for your TH2 and let the TH1 open
I was already doing so. The problem was that just after plotting I was closing the root file, so I couldn’t see the histograms anymore. I think I have solved the problem now.