Add entry in Legend

Hi,

   I run a C ++ macro to make a plot and saved it as .C as well as .eps files so that I can make the changes in .C (mainly cosmetic) if required.  

But when I run this .C file I found that it did not take the Markerstyle and color as was in the original macro.

I can see that in .C file the markerstyle and line style are different. Could someone suggest what could be the cause and why it did not gives the exact output for legend entry as running original macro??

thanks and with best,
sushil
SE_SbyB_TrackMin.C (4.77 KB)

Could you save your original canvas (where everything is OK) as a canvas.root file instead of canvas.C and post the canvas.root file?

Rene

So I run my original macro and saved the canvas as canvas.root attached with this post.

Thanks and with best,
sushil
canvas.root (15.4 KB)

When I save your canvas as a .C file I see that the legend is no correct when I execute the saved C file. I guess that’s what you mean with "in .C file the markerstyle and line style are different."
I am investigating

Ok,

Find attached original macro, simply a C++ file. When I run this macro in root I get a plot . Now I save this plot as .C and .eps file.

Now if I run the save .C file in root I get the same MarkerStyle and Line color for all the curves in the plot but if you see the .C , they have been defined for different marker style and color.

So question is when running this .C why I do not get the same legends as my original macro.
trak_effect_1T.C (2.12 KB)

You have this problem because your graphs all have the same name “Graph”. In the original macro create them with different names and it will be fine.

In your macro just add:

 gr1->SetName("gr1");
 gr2->SetName("gr2");
 gr3->SetName("gr3");
 gr4->SetName("gr4");

after the graphs creation.

Thanks,
It works now.

with best,
sushil