Hi Christian,
Several problems in your script:
- never use gROOT->Reset(); in a named script
- you should declare
TLegend *aLegend
instead of
TLegend aLegend
Otherwise your object will be automatically deleted when
leaving the scope of the function.
- use correct coordinates for the legend
Rene Brun
On Tue, 6 May
2003,
Christian Hansen
wrote:
>
> Hi Rooters,
>
> I'm trying to get TLegend work with this piece of code
>
> TLegend aLegend;
> aLegend = new TLegend(0.5,0.8,1.0,0.2);
> aLegend->AddEntry(graphMIS_gran1,"MIS, gran1","p");
> aLegend->AddEntry(graphMIS_gran2,"MIS, gran2","p");
> aLegend->Draw();
>
> But the legend never shows up in my plot. What is wrong?
> I've attached a test.cxx file which plots a multigraph
> and in the very end of the program it tries to make a legend.
> How should I change this file so that I see the legend
> and it contents?
>
> Best regards,
>
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:11 MET