TMultiGraph Question

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");

do:

[code]mg->Add(g2,“p”);
mg->Add(gf,“l”);

mg->SetMaximum(a);
mg->SetMinimum(b);
mg->Draw(“a”); [/code]
see example in class description of TMultiGraph at
http://root.cern.ch/root/htmldoc//TMultiGraph.html

Rene

I tried that already, and now i tried it again, it doesn’t work !!

  •  W E L C O M E  to  the World of R O O T            *
    
  •                                     *
    
  • Version 4.04/02f 16 July 2005 *
  •                                     *
    
  • You are welcome to visit our Web site *
  •      [root.cern.ch](http://root.cern.ch)

Please send the shortest possible RUNNING script reproducing your problem.

Rene

For instance,

mg->Add(gf,“l”);
mg->SetMaximum(a);
mg->SetMinimum(b);
mg->Draw(“a”);

OR

mg->Add(g2,“p”);
mg->SetMaximum(a);
mg->SetMinimum(b);
mg->Draw(“a”);

doesn’t produce any Graph !

only something like mg->Add(g2,“ax”) does it.
But again mg->Add(g2,“ax”) AND mg->Add(gf,“al”) does it NOT !
Maybe because gf draws a TF1 function ??

Please help !

Sorry i can’t you send a more running script right now, because i have to finish some plots very soon ! ( i will do it without root then…)

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.

Please save our time and answer my question

[quote]Please send the shortest possible RUNNING script reproducing your problem.
[/quote]

Rene

O.K. Thank You !