Hi, In your example, your first graph has a range smaller than the second graph. When using the option "A", TGraph computes the pad range to draw the first graph. There are several possible solutions. See for example $ROOTSYS/tutorials/gerrors2.C or multigraph.C Below is a modification of your example setting the pad range via TPad::DrawFrame. Rene Brun { gROOT->Reset(); c1 = new TCanvas("c1","A Simple Plan",200,10,700,500); c1->SetFillColor(42); c1->SetGrid(); c1->DrawFrame(-1,0,4,7); const Int_t na = 2; Double_t xa[na] = { 0.0,2.0 }, ya[na] = { 1.10000002384,3.29999995232 } ; gra = new TGraph(na,xa,ya); gra->SetFillColor(19); gra->SetLineStyle (3); gra->SetMarkerColor(2); gra->SetMarkerStyle(21); gra->SetTitle("A Simple Plan"); gra->Draw("CP"); const Int_t nb = 2; Double_t xb[nb] = { 1.0,3.0 }, yb[nb] = { 5.80000019073,4.19999980927 }; grb = new TGraph(nb,xb,yb); grb->SetFillColor(19); grb->SetLineStyle (3); grb->SetMarkerColor(4); grb->SetMarkerStyle(21); grb->SetTitle("A Simple Plan"); grb->Draw("CP"); c1->GetFrame()->SetFillColor(21); c1->GetFrame()->SetBorderSize(12); c1->Modified(); } On Fri, 26 Jan 2001, Phlip wrote: > Rootsters: > > I seem to think this should display one panel with two sets of two colored > dots: > > { > gROOT->Reset(); > c1 = new TCanvas("c1","A Simple Plan",200,10,700,500); > c1->SetFillColor(42); > c1->SetGrid(); > > const Int_t na = 2; > Double_t xa[na] = { 0.0,2.0 }, ya[na] = { 1.10000002384,3.29999995232 } ; > gra = new TGraph(na,xa,ya); > gra->SetFillColor(19); > gra->SetLineStyle (3); > gra->SetMarkerColor(4); > gra->SetMarkerStyle(21); > gra->SetTitle("A Simple Plan"); > gra->Draw("ACP"); > > const Int_t nb = 2; > Double_t xb[nb] = { 1.0,3.0 }, yb[nb] = { 5.80000019073,4.19999980927 }; > grb = new TGraph(nb,xb,yb); > grb->SetFillColor(19); > grb->SetLineStyle (3); > grb->SetMarkerColor(4); > grb->SetMarkerStyle(21); > grb->SetTitle("A Simple Plan"); > grb->Draw("ACP"); > > c1->Update(); > c1->GetFrame()->SetFillColor(21); > c1->GetFrame()->SetBorderSize(12); > c1->Modified(); > } > > ROOT thinks otherwise; it only draws the second set. The code resembles > that in tutorial examples such as zdemo.C. > > -- > Phlip phlip_cpp@my-deja.com > ============ http://c2.com/cgi/wiki?PhlIp ============ > -- DARE to resist drug-war profiteering -- >
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:34 MET