How to draw only points in TGraph?


ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


Hi Everyone,
I have two graphs. I am not being able to draw the graph like the attached image. I want to draw the points in such a way that I can distinct them.
I am using the following commands.
‘’’
gr->SetLineColor(2);
gr->SetLineWidth(4);
gr->SetMarkerColor(8);
gr->SetMarkerSize(4);
gr->SetMarkerStyle(28);

gr1->SetLineColor(4);
gr1->SetLineWidth(2);
gr1->SetMarkerColor(2);
gr1->SetMarkerSize(2);
gr1->SetMarkerStyle(20);

c1->Update();
c1->GetFrame()->SetFillColor(21);
c1->GetFrame()->SetBorderSize(12);
c1->Modified();

gr->Draw(“AP”);
gr1->Draw(“same”);
‘’’
where gr and gr1 have been defined previously.

{
   auto gr  = new TGraph();
   gr->SetPoint(0,250.,270.);
   gr->SetPoint(1,500.,275.);
   gr->SetPoint(2,900.,250.);
   gr->SetMarkerColor(kBlue);
   gr->SetMarkerStyle(kFullCircle);

   auto gr1 = new TGraph();
   gr1->SetPoint(0,250.,390.);
   gr1->SetPoint(1,500.,460.);
   gr1->SetPoint(2,900.,420.);
   gr1->SetMarkerColor(kRed);
   gr1->SetMarkerStyle(kFullCircle);

   auto mg = new TMultiGraph();
   mg->Add(gr);
   mg->Add(gr1);
   mg->Draw("AP");
}

Hi,

I bet gr and gr1 are n o t TGraph s but TH1 s
Otherwise there would be no StatBox
Could you show the complete macro

Cheers
Otto

Hi Otto,
Yes I saw that too. But the example posted and the question was about TGraph. That’s why I produced a working example using TGraph. @souvik may come with more details.
Cheers,
Olivier

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