Empty canvas

I am developing a ROOT program. In which, I am trying to draw 9 TProfile in a single canvas. No error in compiling and executing. But the output canvas is empty. Here I have pasted part of the code which is dealing the TCanvas part.

[code]TCanvas *c1 = new TCanvas(“c1”, “”, 640, 480);
c1->Divide(3, 3);

for(short i(1); i <= 9; i++)
{
c1->cd(i);
h[i]->Draw();
}

c1->SaveAs(“temp.pdf”);[/code]

From your code fragment I do not see any problem. The only strange thing is that you run the index from 1 to 9 and the C array (or std::vector) h will be from 0 to 8.

It would be nice to have a more complete example we could run.

Actually the histogram ‘h’ array has more size. Here I am plotting from 1 to 9 only, h[0] is used for other purporse.

I don’t think it will help but … after “Draw” try to add:
gPad->Modified(); gPad->Update(); // note: gPad needs #include "TPad.h"
Also, before “SaveAs”, try to add:
c1->cd(0);

[quote=“Pepe Le Pew”]I don’t think it will help but … after “Draw” try to add:
gPad->Modified(); gPad->Update(); // note: gPad needs #include "TPad.h"
Also, before “SaveAs”, try to add:
c1->cd(0);[/quote]

It worked. Thank you very much.