How can I get rid of poly-line between data points (reviced)

Let me revice my question made previously. Actually, this
is what I am trying to do ultimately. I would like to combine two
graph objects to one to simplify the contents in rootfile and drawing
macro. So I dumped
tg1 and tg2 into TH2F object h2 in the following example. However,
it draws lines when I draw h2 and have no control of MarkerStyle
even which I specified before adding tg1 and tg2 objects in h2.


TFile * rootfile = new TFile(“test.root”,“RECREATE”,“test”);

TH2F * h2 = new TH2F(“h2”,“test”,100,0,11,100,-100,100);
const int N=10;
float x[N], y[N], ex[N], ey[N];
for (int i=0; i SetMarkerStyle(22);
tg1 -> Write(“tg1”);
for (int i=0; i SetMarkerStyle(20);
tg2 -> Write(“tg2”);

h2 -> GetListOfFunctions()->Add(tg1);
h2 -> GetListOfFunctions()->Add(tg2);
h2 -> Write(“h2”);

// rootfile->Write();

return 0;


root> TFile *file = TFile::Open(“test.root”)
root> h2->Draw(“AP”);

following attempt didn’t help:
root> h2->SetMarkerStyle(20);
root> h2->Draw(“AP”);

Could you post your code as an attachment? The code in your mail is
complete garbage ::0.
Before sending your code, I suggest to replace

h2 -> GetListOfFunctions()->Add(tg1); h2 -> GetListOfFunctions()->Add(tg2); by

h2 -> GetListOfFunctions()->Add(tg1,"p"); h2 -> GetListOfFunctions()->Add(tg2,"p");
ie specify the drawing option when adding the graph to the list of functions of h2


It worked! Thanks.