Problem with saving a TH2F histogram as a .root file

Hello,

I’m trying to save a TH2F histogram as a .png file and as a .root file. My problem is when I open the .root file, the colors are not the same as in the png file. Also, the “gStyle->SetTitleFontSize()” function doesn’t seem to work in the root file.

There are other font size parameters that don’t seem to work. To simplify, here is a macro reproducing some of my problems :

[code]{
TCanvas* canvas = new TCanvas(“Canvas”, “Canvas”, 0, 0, 500, 150);

gStyle->SetOptStat(kFALSE);
gStyle->SetPalette(1);
gStyle->SetTitleFontSize((Float_t)0.18);

TH2F* histo = new TH2F("Histo", "Histo", 4, 0, 4, 4, 0, 1);

for(int i = 0; i < 4; ++i)
	histo->Fill(i, (Double_t)0, i+1);

histo->Draw("COLZ");

canvas->Print("C:/root/graph1.root");
canvas->Print("C:/root/graph2.png");

}[/code]

The .png file is exactly what I wanted :

The image associated to the .root file however is not what I expected. I thought it would be the same image as the png file, only editable. Here is a screenshot of what I see when I open the root file :

Am I doing something wrong ? Thanks in advance.

P.S. : I also attached the root file I obtain in case it would be useful.
graph1.root (12.8 KB)

The graph1.root file contains objects with their attributes. If you view the file in a different session you have to set all the the global settings (like gStyle) before opening youtr file.

Rene