How To Save TH1D as png?

I want to draw 4 TH1D in a diagram, I don’t know which api can help me to save TH1D as png or jpg. And How to let one diagram have 4 TH1D ,thank you very much.

for example
image
there are 4 TH1D , but it is save as root, I want to let these 4 TH1D in one diagram,such as

You save the canvas or pad, not the “histogram”, using SaveAs(), see some example code here.
To put several in one canvas, you need canvas->Divide(), see the zones.C example.

Hello this is Gulshan Negi
Well, if you want to save the canvas as a PNG file in the current working directory. To save it as a JPG file instead, simply change the file extension in the file name to “.jpg.”
c->SaveAs(“myhistograms.png”);
Thanks

@dastudillo Try to “SaveAs” a sub-pab.

Thanks every one
I will try to do it
very much :grinning: :grinning: :grinning: :grinning: :grinning: :grinning:

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