Multigraph

Hello ROOT family,

I have 2 TMultiGraphs, which also have a fit with a function (TF1) for each of those graphs.

And I want both to be inside the same TCanvas, the problem is that when I do it, the line of the fit function is lost.

Does anybody know how to do that both are in the same TCanvas and that the fit of each one can be seen?

I tried with this code

TCanvas *canvas1 = new TCanvas("canvas1","canvas1", 1000,1000);
    TMultiGraph *mg1 = new TMultiGraph();
    mg1->Add(grD1);
    mg1->Add(grN1);
    mg1->Draw("AL");
    leg1->Draw("same");

I have 2 similar of this one
image

and when I tried to plot the both, the fit line does not appear

Thank you for your time


Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


Hi,
you can try to fit the graph with the option 0 in this way will not draw the fitting line

grD1->Fit("f",0);

and then plot the TF1 just after drawing the TMultiGraph using the usual option same

f->Draw("same")

Stefano

1 Like

Yesss, that works, thank you!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.