Reset graphic options

Hello, I have one 2D histogram saved in a root file. It has a lot of graphics options already set. I need to modify the graphics in order to make uniform the plot with the others of the paper we are going to publish. Is it possible to load the histo, reset all the graphic options and then plot it with mine? I attach both the root file and the macro I usually use to do that. This time I have no effects. Can you help me?
Thanks a lot in advance.
Regards
Davide Perego
Eames.C (2.3 KB)
CE_1.root (18.6 KB)

Quite simple to do. You have two options
-Option 1: Resetting attributes when reading objects from file

// Load the histogram gROOT->ForceStyle(); //<============= TH2F *histo = (TH2F*)hfile1->Get("Align");

-Option 2 : UseCurrentStyle

// Load the histogram TH2F *histo = (TH2F*)hfile1->Get("Align"); histo->UseCurrentStyle();
Rene

Hello Rene, thanks for your answer, but unfortunately it works let’s say 50% of my needs.
I tried both the two options you suggested, but only the label fonts change. I would like to resize the canvas, to remore the title, to add the Z-bar on the right side (colz option) etc.
Any idea?
Thanks again
Davide

davide,

Your macro was a total mess with a lot of errors (look carefully to all my changes).
In particular, you saved the canvas into the file, you should read it as a canvas, not a TH2D!

[code]{
gROOT->Reset();
// Graphics options…
gStyle->SetOptStat(0);
gStyle->SetOptTitle(0);
gStyle->SetOptFit();
gStyle->SetStatColor(10);
gStyle->SetTextFont(42);
gStyle->SetTitleOffset(1.15,“xyz”);
gStyle->SetLabelFont(42,“xyz”);
gStyle->SetLabelSize(0.030,“xyz”);
gStyle->SetTitleFont(42,“xyz”);
gStyle->SetTitleFillColor(10);
gStyle->SetPalette(1,0);
TGaxis::SetMaxDigits(4);

// Open the file
TFile *hfile1 = new TFile(“CE_1.root”);

// Load the canvas (not the histogram!!!)
TCanvas c = (TCanvas)hfile1->Get(“Align”);
c->FindObject(“dThetavphiRecAll”)->SetDrawOption(“colz”); //was drawn with "col"
c->Draw();

// Save the plot
c->Print(“Alignment_1.eps”);
}
[/code]

Rene