# Printing out the coordinates

how do I print out the coordinates of each point in each plot of the graph?

`````` Int_t nop=100;
Double_t xpt, ypt, del = 0.9975/nop;

TGraph *av1 = new TGraph();

for (Int_t j=0; j < nop; j++)
{
xpt = del*j + 0.0025*del;
av1->SetPoint(j, xpt, 0.0);
}

for (Int_t i=0; i<nof; i++)
{
for (Int_t j=0; j < nop; j++)
{
av1->GetPoint(j, xpt, ypt);
av1->SetPoint(j, xpt, ypt + fpf[i]->Eval(xpt)/(Double_t)nof);
}
}

TGraph *av2 = new TGraph();

for (Int_t j=0; j < nop; j++)
{
xpt = del*j + 0.0025*del;
av2->SetPoint(j, xpt, 0.0);
}

for (Int_t i=0; i<nof; i++)
{
for (Int_t j=0; j < nop; j++)
{
av2->GetPoint(j, xpt, ypt);
av2->SetPoint(j, xpt, ypt + ebu[i]->Eval(xpt)/(Double_t)nof);
}
}

TGraph *av3 = new TGraph();

for (Int_t j=0; j < nop; j++)
{
xpt = del*j + 0.0025*del;
av3->SetPoint(j, xpt, 0.0);
}

for (Int_t i=0; i<nof; i++)
{
for (Int_t j=0; j < nop; j++)
{
av3->GetPoint(j, xpt, ypt);
av3->SetPoint(j, xpt, ypt + ebd[i]->Eval(xpt)/(Double_t)nof);
}
}
``````

thanks for your help.

Hi,
Not sure if I understand, you are already using `GetPoint` to get the coordinates of the points.You want them to appear as text in the plot?

hi @etejedor, i want them to appear in the terminal as output text after running the program

hi @Wile_E_Coyote, I inserted this in the code “TGraph::Print(av1);” but it said

``````error: call to non-static member function without an object argument TGraph::Print(av1);
``````

Hi,
You need to call it on an instance:
`av1->Print()`

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