// macro to test graphs #include "TCanvas.h" #include "TGraph.h" #include "TH1.h" #include "TMath.h" void Graph() { TCanvas *canvas = 0; canvas = new TCanvas("c1","A Simple Graph Example",200,10,700,500); const Int_t n = 2000000; Double_t x[n], y[n]; for (Int_t i=0;iDrawFrame(fMinX, fMinY, fMaxX, fMaxY); frame->SetTitle("a simple graph"); frame->SetXTitle("X title"); frame->SetYTitle("Y title"); frame->GetXaxis()->CenterTitle(kTRUE); frame->GetYaxis()->CenterTitle(kTRUE); TGraph *graph = 0; graph = new TGraph(n, x, y); graph->SetBit(kCanDelete); //delete from TPad graph->SetMarkerStyle(1); graph->SetMarkerColor(1); graph->SetLineStyle(1); graph->SetLineColor(2); graph->Draw("P"); //option "A" (axis) not allowed if axes set with DrawFrame // TCanvas::Update() draws the frame, after which one can change it canvas->Update(); canvas->Modified(); }