Re: Problem with a time axis grid

From: Nicolas Arnaud <narnaud_at_lal.in2p3.fr>
Date: Thu, 08 Dec 2005 08:46:27 -0800

Thanks Olivier!

Is this trick generic in ROOT? I mean: would setting similar parameters to negative values prevent unrequested ROOT optimization? Is this described somewhere in the manual?

Amicalement,

Nicolas

--On jeudi 8 décembre 2005 11:33 +0100 Olivier Couet <Olivier.Couet_at_cern.ch> wrote:

>
> Bonjour Nicolas,
>
> Just do:
>
> scope->GetXaxis()->SetNdivisions(-14 );
>
> a negative number of divisions means that the number of divisions is not
> optimized (by default it is). I tried, it works for me.
>
> Amicalement,
>
> Olivier
>
>
> On Wed, 7 Dec 2005, Nicolas Arnaud wrote:
>
>>
>> Bonjour Olivier,
>>
>> > Can you send a small running macro showing the problem ?
>>
>> You can find it below.
>>
>> The output I got can be found at:
>>
>> http://www.slac.stanford.edu/~narnaud/problem.gif
>>
>> The vertical grid lines are drawn at 16:00 'instead of' 00:00
>>
>> [I'm using ROOT 4.04-02 on Scientific Linux]
>>
>> Amicalement,
>>
>> Nicolas
>>
>> -------------------------------
>>
>> # include <iostream>
>>
>> Int_t grid()
>> {
>> TDatime T0( 1999, 01, 01, 00, 00, 00 );
>> timeOffset = T0.Convert();
>> gStyle->SetTimeOffset( timeOffset );
>>
>> Int_t stopTime = 1133971200;
>> Int_t startTime = stopTime - 86400 * 14;
>>
>> cout << "startTime = " << startTime
>> << " stopTime = " << stopTime << endl;
>>
>> TH2F* scope = new TH2F( "scope", "Stripchart",
>> 100, startTime - timeOffset,
>> stopTime - timeOffset,
>> 100, -2, 2 );
>>
>> Float_t omega = 0.000072722;
>>
>> Int_t currentTime = startTime;
>>
>> while( currentTime <= stopTime )
>> {
>> //cout << "time = " << currentTime << endl;
>> Float_t correctedTime = currentTime - timeOffset;
>> Float_t quantity = sin( omega * correctedTime );
>> scope->Fill( correctedTime, quantity );
>> currentTime += 60;
>> }
>>
>> TCanvas *c1 = new TCanvas( "c1", "c1", 1024, 768 );
>> gPad->SetGrid();
>>
>> scope->GetXaxis()->SetNdivisions( 14 );
>> scope->GetXaxis()->SetTimeDisplay( 1 );
>> scope->GetXaxis()->SetTimeFormat( "%y-%m-%d:%H:%M" );
>> scope->GetXaxis()->SetLabelSize( 0.01 );
>> scope->SetStats( kFALSE );
>> scope->Draw();
>>
>> return( 0 );
>> }
>>
>> -------------------------------
>>
>>
>
> --
> Org: CERN - European Laboratory for Particle Physics.
> Mail: 1211 Geneve 23 - Switzerland Mailbox: J25910
> E-Mail: Olivier.Couet_at_cern.ch Phone: +41 22 7676522
> WWW: http://cern.ch/Olivier.Couet/ Fax: +41 22 7670300
Received on Thu Dec 08 2005 - 17:49:53 MET

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