Saving TCanvas log options to ROOT file

Hi
I am unable to save a canvas with the axis in log scale to a ROOT file.

Below is a short example of the problem:

root [0] TH1F* hist = new TH1F(“hist”, “Test”, 100, 0, 1);
root [1] hist->Fill(0.5);
root [2] TCanvas c1;
root [3] c1.SetLogy()
root [4] hist->Draw() //Here the histogram draws with the y-axis in log scale
root [5] TFile* f = new TFile(“test.root”, “RECREATE”)
root [6] c1.Write()
(Int_t)13479
root [7] f->Close()
root [8] .q

When I then try and open the file:
$root test.root
root [0]
Attaching file test.root as _file0…
root [1] _file0.ls()
TFile** test.root
TFile* test.root
KEY: TCanvas c1;1 c1
root [2] c1->Draw() //Draws with y-axis in linear scale
root [3] c1->GetLogy()
(const Int_t)0

Does anyone have any suggestions on how to save a canvas with log scale ? I am using ROOT 5.28/00c

in your file rootlogon.C comment:

gROOT->ForceStyle();

Hello,
I am coping with the same problem. However, my rootlogon.c file comes empty by default, therefore I cannot comment a line
gROOT->ForceStyle();

If it was meant instead to insert gROOT->ForceStyle(); in rootlogon.c, I did it, but nevertheless the log scale is not present both by inspecting the TCanvas and by testing TCanvas::GetLogy, which gives 0.

I actually also inserted gROOT->ForceStyle(); into my program before saving the TCanvas. Again, no effect.

Viesturs

The log scale is not part of the style attributes