Here is an example (the tutorials/graph.C example) slightly
modified to do the job.
Rene Brun
{
gROOT->Reset();
c1 = new TCanvas("c1","A Simple Graph Example",200,10,700,500);
c1->SetGridx();
c1->SetGridy();
// Draw frame using a 2-d dummy histogram
hframe = new TH2F("hframe","A Simple Graph
Example",2,-0.4,2.4,2,-3,14);
hframe->SetXTitle("X title");
hframe->SetYTitle("Y title");
hframe->Draw();
Int_t n = 20;
Float_t x[n], y[n];
for (Int_t i=0;i<n;i++) {
x[i] = i*0.1;
y[i] = 10*sin(x[i]+0.2);
}
gr = new TGraph(n,x,y);
gr->SetFillColor(19);
gr->SetLineColor(2);
gr->SetLineWidth(4);
gr->SetMarkerColor(4);
gr->SetMarkerStyle(21);
gr->Draw("CP");
}