Bug when saving graphical formats in 5.34

Hello,

I have a bug when saving a canvas in ROOT 5.34

If you try to run the test.C macro in attachment, it will appear fine on screen, but once saved in graphical formats (I tried png, jpg or gif), some huge numbers appear on the bottom axis (see attachment test_534.png).

If the macro is run in ROOT 5.32, the graphical file is fine (in attachment test_532.png).





test.C (23.9 KB)

UP!
Is this the right forum for this issue?

Thanks,
Luca.

I ll check. PS is fine.

I managed to reproduce it with a musch simpler version of your macro:

{
   TCanvas *c1 = new TCanvas("c1", "c1",0,0,600,600);
   TPad *padhigh = new TPad("padhigh", "padhigh",0,0.28,1,1);
   padhigh->Draw();
   padhigh->cd();
   
   THStack *hmcs = new THStack();

   TH1F *hmcs_stack_1 = new TH1F("hmcs_stack_1","",13,-0.5,12.5);

   hmcs_stack_1->GetXaxis()->SetLabelSize(1);

   hmcs->SetHistogram(hmcs_stack_1);
         
   TH1F *h4 = new TH1F("h4","",13,-0.5,12.5);
   hmcs->Add(h4,"");
   
   TH1F *hemb = new TH1F("hemb","",13,-0.5,12.5);
   hmcs->Draw();
   
   padlow = new TPad("padlow", "padlow",0,0,1,0.33);
   padlow->Draw();
   padlow->cd();
   
   TH1F *hratiomc = new TH1F("hratiomc","",13,-0.5,12.5);
   hratiomc->Draw();
   
   c1->Print("c1.png");
}

it appears that this big text is here also on the screen but hidden behind a opaque pad. Anyway we should the same on bot screen and png.
Removing
hmcs_stack_1->GetXaxis()->SetLabelSize(1);
seems to help.
I continue to investigate.

even a simpler one:

{
   TCanvas *c1 = new TCanvas("c1", "c1",0,0,600,600);
   TPad *P1 = new TPad("P1", "P1",0,0.28,1,1);
   P1->Draw();
   P1->cd();
   
   THStack *ST1 = new THStack();
   TH1F *H1     = new TH1F("H1","",13,-0.5,12.5);
   H1->GetXaxis()->SetLabelSize(1);
   ST1->SetHistogram(H1);
         
   TH1F *H2 = new TH1F("H2","",13,-0.5,12.5);
   ST1->Add(H2,"");
   ST1->Draw();
   
   c1->Print("c1.png");
}

Ok, now the following example makes clear what’s going wrong. The text is not clipped on the pad border:

{
   TCanvas *C = new TCanvas("C", "C",0,0,600,600);
   C->SetFillColor(30);

   TPad *P = new TPad("P", "P",0.2,0.2,0.8,0.8);
   P->SetFillColor(5);
   P->Draw();
   P->cd();
            
   TH1F *H = new TH1F("H","",10,0.,1.);
   H->GetXaxis()->SetLabelSize(0.32);
   H->Draw();
   
   C->Print("C.png");
}


Yes,

I worked around by changing the line hmcs_stack_1->GetXaxis()->SetLabelSize(1);

but indeed the bug to solve is that the canvas and the file are different.

Luca.

Exactly. And it turned out it is a clipping issue.

I made a bug report here:

savannah.cern.ch/bugs/index.php?97592