TCanvas *canvas = new TCanvas("canvas"); // some code to draw on the canvas canvas->SaveAs("myplot.png");
TCanvas *canvas = new TCanvas("canvas"); // some code to draw on the canvas canvas->SaveAs("myplot.eps");These examples demonstrate how to use the SaveAs method to save a canvas as an image file in different formats. The package library used is ROOT.