Re: [ROOT] plot two( or three) graphs together on the same canvas

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Feb 01 2001 - 19:56:33 MET


Hi Yayoung,
You should not use teh option "A" for the 3 graphs, only for the first
one.
I suggest to draw a farme via TPad::DrawFrame to set the pad range
and then do not use the options "A" at all.
  c2->DrawFrame(xmin,ymin,xmax,ymax);
  ...
  smvdac_tempgr->Draw("P");
  ...
  bgobotside3_tempgr->Draw("P");

etc

Rene Brun


On Thu, 1 Feb 2001 jayoung@mind.umd.edu wrote:

> Hi,
> 
> I tried to plot two graphs on the same canvas. However, the second graph
> overlaps first one. Could you tell me which part is wrong with my code?
> 
> ----------------- my code
> {
> ...
>   TGraph *hdd_tempgr = new TGraph(no,date,hdd_temp);
>   TGraph *bgobotside3_tempgr = new TGraph(no,date,bgobotside3_temp);
>   TGraph *smvdac_tempgr = new TGraph(no,date,smvdac_temp);
> 
>   TCanvas *c2 = new TCanvas("c2","Temperature", 200,10,700,500);
>   c2->SetBorderMode(0);
>   c2->SetGridx();
>   c2->SetGridy();
> 
>   smvdac_tempgr->SetMarkerColor(3);
>   smvdac_tempgr->SetMarkerStyle(8);
>   smvdac_tempgr->SetMarkerSize(0.3);
>   smvdac_tempgr->SetTitle("Temperature (degrees C) vs. Time (days)");
>   smvdac_tempgr->Draw("AP");
> 
> 
>   bgobotside3_tempgr->SetMarkerColor(5);
>   bgobotside3_tempgr->SetMarkerStyle(8);
>   bgobotside3_tempgr->SetMarkerSize(0.3);
>   bgobotside3_tempgr->Draw("AP");
> 
> 
> 
> 
>   hdd_tempgr->SetMarkerColor(2);
>   hdd_tempgr->SetMarkerStyle(8);
>   hdd_tempgr->SetMarkerSize(0.3);
>   hdd_tempgr->Draw("AP");
> 
>   c2->Modified();
>   c2->Update();
> 
> ...
> }
> 
> 



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:35 MET