SetLogx in a divided canvas

Hi,
i don’t know why this code work properly drawing a log scale on Y (where tc is a TCanvas e gr a TGraph)

[…]
tc->SetLogy();
gr->Draw(…);
[…]

while this other don’t plot a log but just a linear one

[…]
tc->Divide(2);
tc->cd(1);
tc->SetLogy();
gr->Draw(…);
[…]

there is any explain to this?

Cheers
Maurizio

Hi,
another strange thing is that if i use the TCanvas name (instead the tc->cd(num)) to change the section of the canvas

TCanvas *tc = new TCanvas(“Detector”, base, 1280, 1024);
tc->Divide(2);
[…]
Detector_1->SetLogx(1);
gr->Draw(…);
[…]
Detector_2->SetLogx(1);
gr->Draw(…);

it works correctly…

cheers

The log scale option must be selected on the current pad, not on the canvas.

In your first example, you should do

TCanvas *tc = new TCanvas(“Detector”, base, 1280, 1024);
tc->Divide(2);
tc->cd(1);
gPad->setLogy();

Rene