TGraphAssymError draw options

Hey there,

Is there a way to save a TGraphAssymError canvas without lines between the markers? Right now I draw my plots using:

graph -> Draw("AP"); // graph is a pointer to a TGraphAssymError objectt

An example output canvas is:

(Maybe it is the saving of the canvas to a TFile that causes the problem?)

Cheers,
Adam Hunyadi

Okay, it seems that the problem was in me saving the graph instead of the canvas. Please delete this question :slight_smile:

If this command gives you the attached plot there is a problem … is it really the case ? with “AP” option you should be see the line connecting the points.

I think this is a misunderstanding of what SaveAs does. It does not save the draw options.

I believe this is the steps taken that were taken:

{
   TGraphAsymmErrors *g = new TGraphAsymmErrors(4);
   g->SetMarkerStyle(kOpenCircle);
   g->SetPoint(0,1,9);
   g->SetPoint(1,2,8);
   g->SetPoint(2,2.5,11); 
   g->SetPointError(2,0,0,2,2.5);
   g->SetPoint(3,3.5,6); 
   g->SetPointError(3,0,0,2.5,2);
   g->SaveAs("test.root");
   
   TCanvas *c = new TCanvas("c","");
   c->DivideSquare(2);

   c->cd(1); 
   g->Draw("AP");

   c->cd(2);
   TFile *f = new TFile("test.root");
   f->Get("Graph")->Draw(); //Uses default not AP
}  

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.