{ gROOT->Reset(); c1 = new TCanvas("c1","A Simple Graph Example",200,10,700,500); const Int_t n = 20; Double_t x[n], y[n]; for (Int_t i=0;iSetLineWidth(4); gr->SetMarkerStyle(21); gr->SetTitle("a simple graph"); gr->GetXaxis()->SetTitle("X title"); gr->GetYaxis()->SetTitle("Y title"); gr->Draw("ACP"); // TCanvas::Update() draws the frame, after which one can change it c1->Update(); c1->GetFrame()->SetFillColor(21); c1->GetFrame()->SetBorderSize(12); c1->Modified(); hpx = new TH1F("hpx","This is the px distribution",100,-4,4); hpxpy = new TH2F("hpxpy","py vs px",40,-4,4,40,-4,4); hprof = new TProfile("hprof","Profile of pz versus px",100,-4,4,0,20); ntuple = new TNtuple("ntuple","Demo ntuple","px:py:pz:random:i"); // Fill histograms randomly gRandom->SetSeed(); Float_t px, py, pz; const Int_t kUPDATE = 1000; for (Int_t i = 0; i < 25000; i++) { gRandom->Rannor(px,py); pz = px*px + py*py; Float_t random = gRandom->Rndm(1); hpx->Fill(px); hpxpy->Fill(px,py); hprof->Fill(px,pz); ntuple->Fill(px,py,pz,random,i); if (i && (i%kUPDATE) == 0) { if (i == kUPDATE) hpx->Draw(); c1->Modified(); c1->Update(); if (gSystem->ProcessEvents()) break; } } gDirectory->Append(gr); new TBrowser(); }