Re: [ROOT] Axis II

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Aug 20 2003 - 09:20:41 MEST


Hi Alexander,

The problem is not to align the labels on the tick marks, but to place the
primary tick marks at the right place. In your case you want a primary tick at
pi/2, pi, 3*pi/2, 2*pi.
This requires a new option to support automatically axis labels with
the pi notation. We will work on this.

Rene Brun

Alexander Wagner wrote:
> 
> Hi!
> 
> Sorry, but again a question about axis labeling where I'm
> not be able to come up with a more elegant solution. For
> some plots I'd like to have an axis labled by multiples of
> pi where the pi should be written as a real pi uning the
> Latex functions of root. My plots are multiple TGraph
> objects with an x-axis running from 0 to 6.28... Now the
> only solution I was able to come up with is something like
> that:
> 
> TH2F *h1 = new TH2F("h","",16, xmin,xmax, 10000, ymin, ymax);
> TGaxis::SetMaxDigits(1);
> h1->SetStats(false);
> h1->GetXaxis()->SetLabelSize(0.06);
> h1->GetXaxis()->SetBinLabel( 4, "#frac{#pi}{2}");
> h1->GetXaxis()->SetBinLabel( 8, "#pi");
> h1->GetXaxis()->SetBinLabel(12, "#frac{3}{2} #pi");
> h1->GetXaxis()->SetBinLabel(16, "2 #pi");
> h1->Draw();
> 
> gr1->Draw("C");
> gr2->Draw("C");
> 
> I.e. drawing an empty TH2F and setting at some crude bins
> (just so that the label coincides with the tick marker).
> Is there some possibility not to set the BinLabel but the
> TickLabel?
> 
> --
> 
> Kind regards,                /                 War is Peace.
>                             |            Freedom is Slavery.
> Alexander Wagner            |         Ignorance is Strength.
> ----------------------------|
> Theoretische Physik II      | Theory     : G. Orwell, "1984"
> Universitaet Wuerzburg     /  In practice:   USA, since 2001



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:14 MET