Hello everybody,
I was looking over the forums some answer related to my post, but i didn’t see something that could help me at all. Sorry if didn’t do well!!!
I just want to add an entry in a legend with the right color, getting it from a fit. Mi code is:
// I’m plotting some graphs in different canvas, so I’m changging color of them.
gra1 = new TGraph (800, xtupleg->GetV2 (), xtupleg->GetV1 ());
gra1->SetLineColor (1 + nextcolor);
gra1->Draw ("apl");
gra1->Fit ("pol1", "", "", 100, 350);
pol1->SetLineColor (1 + nextcolor);
leg = new TLegend(.7,.7,.9,.9);
leg -> AddEntry(gra1,fn->GetString(),"l"); <<--This is fine!!
[color=red]leg -> AddEntry(pol1,"Fitting ...." ,"l"); <<---Here is my problem[/color]
leg -> Draw();
gra1->SetTitle (fn->GetString());
All the lines fitted had the same color. This problem doesn’t appear when I put a constant number instead of 1 + nextcolor.
Many thanks in advanced
Rafael