2D Multi Graph

Hi… all rooters.

From Today morning…
I am suffering so much on drawing 2 TGraph2D on one canvas.

TGraph2D *dt_body  = new TGraph2D();

TGraph2D *contour1  = new TGraph2D(n_points, x,y,z);
TMultiGraph *mg = new TMultiGraph();
    mg -> Add(dt_body);
    mg -> Add(contour1); 
mg-> Draw("ap");

It dosen’t work…

Is therer any way to draw 2 TGrap2D in one canvas?

thanks for advance…


  1. see class description of TMultiGraph : the objects are supposed
    to be of type TGraph or inherit from it like TGraphErrors .
    So this approach will not work .

  2. You write that you want two graphs in one canvas . In that
    case create 2 pad’s on one canvas, see tutorials/graph2dfit.C
    where actually six pads are created .

  3. if you want the two TGraph2D objects in one pad, specify "SAME"
    option with the second one .