I tried to add a TGraph to a TGraphErrors within the TMultiGraph.
Each single Graph is plotted proper ( they both have the same Maximum, Minimum),
but after ‘TMultiGraph->add’ one graph to the other the canvas gets screwed up and i only see the second added graph. I’ve tried any combination of Draw-options i can think of, but NO WAY !!
Please Help ! Thank You !
TGraphErrors *g2 = new TGraphErrors(n,x,y,xerror,yerror);
g2->SetMarkerSize(1.0);
g2->SetMarkerStyle(8);
TF1 *df1 = new TF1("fittedfunc",printfitfunc,xmin,xmax,numberofpars);
df1->SetParameters(fittedpar[0],fittedpar[1]);
TGraph *gf = new TGraph(df1);
gf->SetLineColor(2);
mg->Add(g2,"ap");
mg->Add(gf,"al");
mg->SetMaximum(a);
mg->SetMinimum(b);
mg->Draw("a");
It looks like that TMultiGraph is not working as it is supposed to:
TMultiGraph *mg = new TMultiGraph();
TGraphErrors *g2 = new TGraphErrors(nlines,epoch,vlos,epocherror,vloserror);
//g2->SetMaximum(1255);
//g2->SetMinimum(1245);
mg->Add(g2,"ap");
mg->SetMaximum(1255);
mg->SetMinimum(1245);
mg->Draw("ap");
If you set the Maximum/Minimum as it is done here, TMultiGraph totaly messes up the Graph, it even looks like it creates some “additional” points ?!
ONLY when SetMinimun/Maximum is done within the TGraphErrors, TMultiGraph draws the graph right !!
BTW, i started with ROOT about 3 Months ago. I have to say that my starting optimism is slightly gone. I spend too much time to find out that things are not working as they should.