i am having a hard time with saving multiple plots (canvases) to a single pdf (i always ended with damaged file / file without any content)
the reproducer: prob_tpdf-Copy1.ipynb (107.5 KB)
Annd that’s what you notebook is doing. According to the file you sent it seems the execution went well. I am not sure why in the case of a notebooks you end with an empty file. Can you try with the normal ROOT and to see if the problem is due to you macro or to the fact you are running it in a notebooks ?
void t() {
TCanvas* canvas = new TCanvas("canvas");
TH1F* histo = new TH1F("histo","test 1",10,0.,10.);
histo->SetFillColor(2);
for (int i=0;i<4; i++){
histo->Fill(2.*i);
histo->Draw();
if (i==0) canvas->Print("plots.pdf(",Form("Title: bin %d",i));
else if (i==3) canvas->Print("plots.pdf)",Form("Title: bin %d",i));
else canvas->Print("plots.pdf",Form("Title: bin %d",i));
}
}