I am trying to write a TMultiGraph containing two TGraphs to a root file. I can write each TGraph individually as their own object to the root file and all the points show up. When I use a TBrowser to look at the file, the TMultiGraph does not show any points. Im not sure what I am doing wrong.
Here is my code:
myfile = rt.TFile( f'../../web/static/Runs/{x.run_num}/root/chambers.root', 'RECREATE' )
myfile.mkdir("Lumi_iMon/")
myfile.cd("Lumi_iMon/")
c1 = rt.TCanvas( 'c1', 'Lumi_iMon', 200, 10, 700, 500 )
c1.SetGrid()
x_ML1 = np.array(lumi_ML1,dtype = float)
x_ML2 = np.array(lumi_ML2,dtype = float)
y_ML1 = np.array(iMon_ML1,dtype = float)
y_ML2 = np.array(iMon_ML2, dtype = float)
gr = rt.TGraph(len(x_ML1),x_ML1,y_ML1)
gr1 = rt.TGraph(len(x_ML2), x_ML2, y_ML2)
mg = rt.TMultiGraph()
mg.GetYaxis().SetTitle( 'Chamber HV IMon' )
mg.GetXaxis().SetTitle( 'Instantaneous Luminosity' )
mg.SetName(f"BOL2C09_lumi")
gr.SetTitle("ML1")
gr.SetMarkerStyle(8)
gr.SetMarkerSize(0.7)
gr.SetMarkerColor(2)
gr1.SetTitle("ML2")
gr1.SetMarkerStyle(8)
gr1.SetMarkerSize(0.7)
gr1.SetMarkerColor(4)
mg.Add(gr)
mg.Add(gr1)
mg.Draw( 'AP' )
c1.Update()
mg.Write()
c1.Close()
myfile.Close()
Here are some screenshots of my TBrowser (first picture is TMultiGraph, second is TGraph individually):