Re: problem with y-scale (a bug?)

From: Rene Brun <Rene.Brun_at_cern.ch>
Date: Fri, 20 Jan 2006 19:40:12 +0100 (MET)


In general, it does not make much sense to call SetLimits on a non empty histogram. In your particular example, it may work, because the TH2 is used only to set the limits of the plot. The real data being in a TGraph object. We will have to find a better way.

Rene Brun

On
Fri, 20
Jan 2006, Hajo Molegraaf wrote:

> Thanks. This works, but one problem is that if I decide to change the y-scale
> then any other things I changed in the graph (for example an arrow that I
> added) are deleted/reset.
> I added // *MENU* after the declaration of the function SetLimits in
> hist/inc/TAxis.h and recompiled the source. Now SetLimits shows up in the
> pop-up menu for the y-axis. Using this I can change the y-scale as I want.
> But perhaps there are reasons not to do this. Is this bad practice?
>
> Hajo.
>
>
>
>
>> From: Rene Brun <Rene.Brun_at_cern.ch>
>> To: Hajo Molegraaf <hjausenet_at_hotmail.com>
>> CC: roottalk_at_pcroot.cern.ch
>> Subject: Re: [ROOT] problem with y-scale (a bug?)
>> Date: Thu, 19 Jan 2006 21:03:13 +0100 (MET)
>>
>> When using the TreeViewer you can set the histogram binning in
>> the "Histogram" box in the top bar. In your case you can set
>> htemp(30,0,300,100,1,1e5)
>>
>> Then click on the Draw button
>>
>> Rene Brun
>>
>> On Thu, 19 Jan 2006, Hajo Molegraaf wrote:
>>
>>> Hi,
>>>
>>> I like the TreeViewer for TNtuples that can be lanched from the TBrowser,
>>> but the y-range of a plot can not be set properly using the GUI.
>>>
>>> With the following script I create a root file
>>>
>>> //************************
>>> {
>>> TFile* file = new TFile("test.root","RECREATE");
>>> TNtuple* data = new TNtuple("data","","Temperature:Resistance");
>>> double T, R;
>>> for( T = 10.0; T < 300.0; T += 1.0 )
>>> {
>>> R = T*T;
>>> data->Fill(T,R);
>>> }
>>>
>>> file->Write();
>>> file->Close();
>>> }
>>> //*************************
>>>
>>> I can open this root file in the TBrowser and I can view the TNtuple with
>>> the TreeViewer. I drag the Temperature branch to X and the Resistance
>>> branch to Y and I click on the button to draw the graph. This creates a
>>> nice graph, but I want to have a logaritmic y-scale. So I click on the
>>> canvas and choose SetLogy. This changes the y-scale from around 2.5e3 to
>>> 1e5. Well, I want to see all the data, so I click on the y-axis and select
>>> SetRangeUser. I fill in 10 for ufirst and 1e7 for ulast. This changes the
>>> y-range from 3e5 to 1e7.
>>>
>>> How can I change the y-range? I know I can do it with a script using
>>> SetLimits, but it seems that using only the GUI it does not work properly.
>>> Is it not possible to use SetRangeUser for this? Why does it respond so
>>> strange?
>>>
>>> By the way, is it an idea to add SetLimits to the popup menu for the axis
>>> by adding '// *MENU*' to the function SetLimits in include/TAxis.h ?
>>>
>>> I'm using ROOT Version 5.09/01 16 December 2005, Compiled for linux
>>> after downloading the CVS version.
>>>
>>> Thanks,
>>> Hajo Molegraaf
>>>
>>> _________________________________________________________________
>>> Nieuw op MSN Messenger 7.5: Dynamische achtergronden
>>> http://www1.imagine-msn.com/Messenger/Audio.aspx
>>>
>
> _________________________________________________________________
> Meer ruimte nodig? Maak nu je eigen Space http://spaces.msn.nl/
>
Received on Fri Jan 20 2006 - 19:40:26 MET

This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:31:56 MET