Hi Dugan,
I tested your macro with 3.01/06 and 3.02/02. Same result. I do not see a
problem. Are you sure that you use 3.01/06 ?
You will find below an example with a TMultiGraph
Rene Brun
void test()
{
//TCanvas *c1 = new TCanvas("c1");
//c1->DrawFrame(0,0.7,20,1.1);
TMultiGraph *g = new TMultiGraph("g",
"Efficiency vs.Threshold for CEM(1,x) CJT(2,7 or 10)");
Double_t x[] = {0,10};
Double_t y[] = {0.95,1};
TGraph *gr1 = new TGraph(2,x,y);
x[0]=0.0;
x[1]=20.0;
y[0]=0.1;
y[1]=1.1;
TGraph *gr2 = new TGraph(2,x,y);
g->Add(gr1);
g->Add(gr2);
//g->Draw("AP"); //if DrawFrame used
g->Draw("AP");
leg = new TLegend(0.6,0.7,0.9,0.9);
leg->AddEntry(g,"CJT(2,7)","l");
leg->AddEntry(gr1,"CJT(2,7)","l");
leg->SetHeader("Thresholds");
leg->Draw();
}
oneil@fnal.gov wrote:
>
> Hi Rene,
> I have attached a working example (test.C). I have set the y-axis range
> to 0.9-1.1, if I set the lower bound to 0.7 instead the font-size
> dramatically increases.
>
> Thank you for your suggestions! I will try multigraph.
>
> Cheers,
> Dugan.
>
> On Mon, 29 Oct 2001, Rene Brun wrote:
>
> > Hi Dugan,
> >
> > I cannot reproduce your problem with TLegend.
> > Could you send a simple but working macro reproducing this problem ?
> >
> > Note that you can simplify your program in two ways.
> >
> > - Instead of:
> >
> > const Int_t m=2;
> > Float_t x1[m],z[m];
> >
> > x[0]=0.0;
> > x[1]=20.0;
> > y[0]=0.75;
> > y[1]=1.1;
> > TGraph *g = new TGraph(m,x,y);
> > g->SetTitle("Efficiency vs.Threshold for CEM(1,x) CJT(2,7 or 10)");
> > you can do (assuming a TCanvas already craeted)
> > gPad->drawFrame(0,0.75,20,1.1);
> >
> > or/and
> > use a TMultiGraph object.
> >
> > Rene Brun
> >
> >
> > oneil@fnal.gov wrote:
> > >
> > > Hi,
> > >
> > > I am trying to overlay a bunch of graphs, so I make a dumb one to start
> > > with y-axis range from 0.75 to 1.1
> > >
> > > const Int_t m=2;
> > > Float_t x1[m],z[m];
> > >
> > > x[0]=0.0;
> > > x[1]=20.0;
> > > y[0]=0.75;
> > > y[1]=1.1;
> > > TGraph *g = new TGraph(m,x,y);
> > > g->SetTitle("Efficiency vs.Threshold for CEM(1,x) CJT(2,7 or 10)");
> > >
> > > Then I create a bunch of other graphs with stuff in them
> > >
> > > TGraph *gr1 = new TGraph(n,x,y1);
> > > TGraph *gr2 = new TGraph(n,x,y2);
> > > etc.
> > >
> > > Then I draw my dumb graphs and create a legend
> > >
> > > g->Draw("AP");
> > > gr1->Draw("P");
> > > etc.
> > >
> > > leg = new TLegend(0.6,0.6,0.9,0.9);
> > > leg->AddEntry(g,"CJT(2,7)","l");
> > > leg->AddEntry(gr1,"CJT(2,7)","l");
> > > leg->SetHeader("Thresholds");
> > >
> > > Then draw it.
> > >
> > > leg->Draw();
> > >
> > > The problem is that the font in the legend comes out really small. It
> > > seems intimately connected to the y-range of the axis. If I make the range
> > > 0-1 it works great. The problem seems to occur when I make the lower
> > > bound non-zero....I get linear shrinkage as I approach the upper bound.
> > > Any ideas? It is as if it is not using NDC anymore....
> > >
> > > I am using ROOT v3.01/06.
> > >
> > > Thanks,
> > > Dugan.
> > > ----------------------------------------------------------------------------
> > > Dugan O'Neil E-mail : oneil@fnal.gov
> > > Dugan.O'Neil@cern.ch
> > > Dept. of Physics and Astronomy web : http://www-d0.fnal.gov/~oneil
> > > Michigan State University
> > >
> > > phone:(630)840-2829 It's too bad that whole families
> > > fax :(630)840-8886 have to be torn apart by something
> > > as simple as wild dogs.
> > > - Jack Handey
> > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> > > Mail: Couriers:
> > > MS 352 Kirk and Wilson Streets
> > > Fermilab Mail Station 352
> > > P.O.Box 500 Fermilab
> > > Batavia, IL 60510-0500 Batavia, IL 60510-0500
> > > ----------------------------------------------------------------------------
> >
>
> ----------------------------------------------------------------------------
> Dugan O'Neil E-mail : oneil@fnal.gov
> Dugan.O'Neil@cern.ch
> Dept. of Physics and Astronomy web : http://www-d0.fnal.gov/~oneil
> Michigan State University
>
> phone:(630)840-2829 It's too bad that whole families
> fax :(630)840-8886 have to be torn apart by something
> as simple as wild dogs.
> - Jack Handey
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> Mail: Couriers:
> MS 352 Kirk and Wilson Streets
> Fermilab Mail Station 352
> P.O.Box 500 Fermilab
> Batavia, IL 60510-0500 Batavia, IL 60510-0500
> ----------------------------------------------------------------------------
>
> --------------------------------------------------------------------------------
>
> Name: test.C
> test.C Type: Plain Text (TEXT/PLAIN)
> Encoding: BASE64
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:05 MET