Change axis' labels' size of a THStack without drawing it

Dear all,

I have a THStack containing 3 histograms. One process (processA) creates it, then serialize it and put it in a db. Another process (processB) retrieve it and display it (ie. draw on a canvas).

The labels on the x axis are too big. I would like to use SetLabelSize(0.03) on the X axis but I can do this only after the THStack has been drawn. However, the process displaying the object doesn’t know anything about it and should not manipulate it.

How can I set the size of the axis labels within processA, without drawing the THStack ?

Thanks in advance for your help,
Barth

You can do something like in the example below. In principle the generated histogram depends on the drawing options, here I assime the default with stack.

Rene

void hs3() {
   TH1F *h1 = new TH1F("h1","test1",100,-3,3);
   h1->FillRandom("gaus",5000);
   TH1F *h2 = new TH1F("h2","test2",100,-3,3);
   h2->FillRandom("gaus",10000);
   TH1F *h3 = new TH1F("h3","test3",100,-3,3);
   h3->FillRandom("gaus",15000);
   THStack *hs = new THStack("hs","test");
   hs->Add(h1);
   hs->Add(h2);
   hs->Add(h3);
   hs->SetHistogram(new TH1F("hstot","",100,-3,3));
   hs->GetHistogram()->GetXaxis()->SetLabelSize(0.02);
   hs->GetHistogram()->GetXaxis()->SetLabelColor(kRed);
   TFile f("hs3.root","recreate");
   hs->Write();
   hs->Draw();
}

Thank you, using SetHistogram made the trick.
However, it brought a new question : when using SetHistogram, the statistics box of the histo appears. How to remove it in processA, ie. before the Draw() ? is it possible at all ?

thank you for your help

Barth

see this variant

Rene

void hs3() {
   TH1F *h1 = new TH1F("h1","test1",100,-3,3);
   h1->FillRandom("gaus",5000);
   TH1F *h2 = new TH1F("h2","test2",100,-3,3);
   h2->FillRandom("gaus",10000);
   TH1F *h3 = new TH1F("h3","test3",100,-3,3);
   h3->FillRandom("gaus",15000);
   THStack *hs = new THStack("hs","test");
   hs->Add(h1);
   hs->Add(h2);
   hs->Add(h3);
   TH1F *hstot = new TH1F("hstot","",100,-3,3);
   hstot->SetStats(0);
   hs->SetHistogram(hstot);
   hs->GetHistogram()->GetXaxis()->SetLabelSize(0.02);
   hs->GetHistogram()->GetXaxis()->SetLabelColor(kRed);
   TFile f("hs3.root","recreate");
   hs->Write();
   hs->Draw();
}

Thank you very much !