Re: TGraph with non-linear axis

From: Georgy Golovanov <geoang_at_lxmx00.jinr.ru>
Date: Tue, 25 Oct 2005 16:44:26 +0400

Hi,

        I can't use SetLogx() because my function is not exactly Log (see the code below). I defined a new function, then applied one to the TGaxis(). The axis looks fine on the canvas. Is there any way to apply this coordinate axis to the TGraph?
Thanks in advance,


Double_t Eta(Double_t *x, Double_t *par) {

    return 2.0*TMath::ATan(TMath::Exp(-1.0*x[0])); }

void AxisTest() {

    gROOT->Reset();

    TCanvas* c1 = new TCanvas("c1", "ddd", 800, 600);     c1->Range(0, 0, 100, 100);         

    TF1* f1 = new TF1("f1", Eta, -4.5, 4.5, 1);

    TGraph* graph;

    TGaxis *A1 = new TGaxis(5, 10, 95, 10, "f1", 50510, "+-", 100);

    A1->SetTextColor(1);
    A1->SetLabelSize(0.02);
    A1->Draw();

}

On Tuesday 25 October 2005 16:04, Olivier Couet <Olivier.Couet_at_cern.ch> wrote:
> Hi,
>
> Can you send a running example showing what you are doing ? why don't you
> simply set the option SetLogx() on the canvas ?
>
> O.Couet
>
> On Tue, 25 Oct 2005, Georgy Golovanov wrote:
> > Dear Rooters,
> >
> > I'm trying to draw a TGraph with non-linear X-axis (like Log
> > scale). I've constructed a TGaxis with hand-made function and it looks
> > fine on the canvas, but the problem is how to apply this axis to the
> > TGraph. Is it possible?
> > Thanks for any help,
> >
> > - Georgy
Received on Tue Oct 25 2005 - 14:42:39 MEST

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:13 MET