Saving 'subfigure' while drawing them in a divide canvas

Hi experts, how to perform operation as described in the topic ?
naively, I suppose the following work, but it didnt…

zz= [gr1,gr2,gr3,gr4]

c = r.TCanvas("c","c",800,600)
c.Divide(2,2)

for i in range(4):
    cc = c.cd(i+1) 
    zz[i].Draw()
    cc.SaveAs("{}.png".format(i))

c.Draw()
c.Print("all.png")

(I dont know what we have when we use TCanvas::Divide() so i put ’ ’ around the subfigure. can anyone point out how to describe this correctly?)


ROOT Version: 6.26 (conda-forge)
Platform: Ubuntu 20.04
Compiler: Not Provided


SaveAs works always on complete canvases, not on subpads.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.