Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
pad2png.C File Reference

Detailed Description

View in nbviewer Open in SWAN
Create a canvas and save as png.

void pad2png()
{
TCanvas *c = new TCanvas("c1", "Creating image from histogram drawing", 800, 600);
TH1F *h = new TH1F("gaus", "gaus", 100, -5, 5);
h->FillRandom("gaus", 10000);
c->Add(h);
c->Update();
std::unique_ptr<TImage> img(TImage::Create());
img->FromPad(c);
img->WriteImage("canvas.png");
}
#define c(i)
Definition RSha256.hxx:101
#define h(i)
Definition RSha256.hxx:106
The Canvas class.
Definition TCanvas.h:23
1-D histogram with a float per channel (see TH1 documentation)
Definition TH1.h:878
static TImage * Create()
Create an image.
Definition TImage.cxx:34
Author
Valeriy Onuchin

Definition in file pad2png.C.