RE: strange behaviour of axes label fonts for TH2F

From: Olivier Couet <Olivier.Couet_at_cern.ch>
Date: Thu, 21 Apr 2011 13:31:07 +0000


Dear Pietro,
I was confused because you said it is ok with TH1F. For me TH1F and TH2F behave exactly the same ie: The global settings via gStyle should be done before the objects creation.
TH1F and Th2F behaviors are consistent for me Cheers,
Olivier

-----Original Message-----
From: owner-roottalk_at_root.cern.ch [mailto:owner-roottalk_at_root.cern.ch] On Behalf Of Pietro Govoni Sent: Thursday, April 21, 2011 3:24 PM
To: roottalk (Mailing list discussing all aspects of the ROOT system.) Subject: Re: [ROOT] strange behaviour of axes label fonts for TH2F

Dear Olivier,

this is what I get as well (see the first part of my email). It's the other way that does not work, and it would be useful if it worked, since I produce histograms, save them in a file and plot them later on interactively, where all my style settings are setup.

Best regards,

pietro

On Apr 21, 2011, at 15:21 , Olivier Couet wrote:

> 
> 
> I did:
> 
> root [0] gStyle->SetLabelFont (42,"xyz") ;
> root [1] TH2F h2("h2", "h2", 10, 0, 10, 10, 0, 10) ;
> root [2] TCanvas c1 ;
> root [3] h2.Draw();
> 
> and the axis fonts a all 42
> 
> 
> 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
> 
> On Thu, 21 Apr 2011, Pietro Govoni wrote:
> 
>> Nor gROOT->ForceStyle (), nor c1.Update () work unfortunately.
>> 
>> pietro
>> 
>> 
>> On Apr 21, 2011, at 14:44 , Olivier Couet wrote:
>> 
>>> Have you tried gROOT->ForceStyle() ?
>>> 
>>> On 4/21/11 2:04 PM, "Pietro Govoni" <Pietro.Govoni_at_mib.infn.it> wrote:
>>> 

>>>> Dear Rooters,
>>>>
>>>> it seems that building a TH2F forces the labels of its axes to keep the
>>>> gStyle properties at the creation time.
>>>> On my Mac, with root 5.27.02, if I run:
>>>>
>>>> gStyle->SetLabelFont (42,"xyz") ;
>>>> TH2F test ("test", "test", 10, 0, 10, 10, 0, 10) ;
>>>> TCanvas c1 ;
>>>> test.Draw () ;
>>>>
>>>> I get the plot with the label font 42, while if I switch the first two
>>>> lines as follows:
>>>>
>>>> TH2F test ("test", "test", 10, 0, 10, 10, 0, 10) ;
>>>> gStyle->SetLabelFont (42,"xyz") ;
>>>> TCanvas c1 ;
>>>> test.Draw () ;
>>>>
>>>> I get the labels written with the default font.
>>>> This does not happen with TH1F objects.
>>>> Is there a way to change the fonts after the histo is created? (trivial
>>>> use case: a code saves the histo, another code makes the nice plotting)
>>>>
>>>> Best regards,
>>>>
>>>> pietro

>>
>> Received on Thu Apr 21 2011 - 15:31:13 CEST

This archive was generated by hypermail 2.2.0 : Thu Apr 21 2011 - 23:50:02 CEST