Hello,
I hope this is not a duplicate, I found similar questions but not the exact solution I needed.
I’m generating 6 TGraphErrors with drawing option “AP”, i.e. without lines connecting points.
I have drawn a Pad called c4 on the canvas, divided it into 6 pads, and drawn each TGraphErrors in each division.
I want to save the graphs into a root file, because I want to open them later and be able to perform some simple operations on them. But I want them to be saved with option “AP” and not “ALP”… is there a way to save them on the rootfile directly without connecting lines?
I tried 3 different ways:
TFile* f1 = TFile::Open(rootfile.c_str(),"RECREATE");
canv4->Write(); //canv4 is the canvas
c4->Write(); //c4 is a Pad drawn on canvas canv4, divided into 6, in each division there's a graph
g0_g1x->Write("g1x");
g0_g1y->Write("g1y");
g0_g2x->Write("g2x");
g0_g2y->Write("g2y");
g0_g3x->Write("g3x");
g0_g3y->Write("g3y");
f1->GetList()->Add(g0_g3y_muH2);
f1->Write();
f1->Close();
canv4->Write() saves the whole canvas, without connecting lines, but I have all graphs on same canvas and I can’t edit them (for example SetLogy doesn’t work, SetRangeUser is not available…)
c4->Write() saves a folder in the rootfile in which there should be the content of each division of the divided pad. But when I click on them in TBrowser to open them I get a “segmentation violation” error on the terminal
g0_g1x->Write(“g1x”) (and similar) saves each single TGraph separately and they’re editabel (my preferred option), but they’re save with the malefic lines…
Same applies to graph saved with f1->GetList()->Add(g0_g3y).
I have read that Write command does not save the drawing options… Is there a way to “add them” to the rootfile?
Thanks a lot,
Martina