3### Keeping the canvas open after drawing in Python 
    4- If the call to 
TH1.
Draw is 
a top-level statement (i.e. the histogram remains in scope at the end of the script), 
e.g. 
 
    6# short example makeAndDrawHisto.py: initialize a histogram and draw it on a canvas 
    7test_histo = 
ROOT.TH1D(
"test_histo", 
"Histogram to draw", 200, -5, 5)
 
    8test_histo.FillRandom(
"gaus", 1000)
 
    9test_canvas = 
ROOT.TCanvas(
"test_canv", 
"test_canv", 900, 700)
 
   12It is sufficient to call Python with the flag `-i` to keep the 
TBrowser open:
 
   14# -i flag keeps the TBrowser open with the TCanvas on it 
   15python -i makeAndDrawHisto.py
 
   18- If the call to 
TH1.
Draw is not at top-level, both the 
TCanvas and 
TH1 objects need to remain in scope. One way to accomplish 
this is with 
ROOT.SetOwnership, 
as in 
this example:
 
   20# contents of short example makeAndDrawHistoInMain.py:  
   23    Initialize a histogram and draw it in a non-top level function, using ROOT.SetOwnership to keep the canvas and histogram open after execution 
   25    test_histo = 
ROOT.
TH1D(
"test_histo", 
"Histogram to draw", 200, -5, 5)
 
   28    test_canv = 
ROOT.
TCanvas(
"test_canv", 
"test_canv", 900, 700)
 
   31    test_canv.SaveAs(
"myDrawExample.png")
 
   33if __name__ == 
'__main__':
 
   36To keep the 
TBrowser open, the Python script should be run with the `-i` flag:
 
   38python -i makeAndDrawHistoInMain.py
 
Using a TBrowser one can browse all ROOT objects.
 
1-D histogram with a double per channel (see TH1 documentation)
 
TH1 is the base class of all histogram classes in ROOT.
 
void Draw(Option_t *option="") override
Draw this histogram with options.
 
The histogram painter class.
 
h1 FillRandom("gaus", 30000)