# Plotting points on the graph

**URL:** <https://root-forum.cern.ch/t/plotting-points-on-the-graph/35791>\
**Category:** Newbie\
**Created:** [August 27, 2019, 3:32pm UTC](https://root-forum.cern.ch/t/plotting-points-on-the-graph/35791 "2019-08-27T15:32:48Z")\
**Posts on this page:** 12\
**Page:** 3

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [September 11, 2019, 7:38am UTC](https://root-forum.cern.ch/t/plotting-points-on-the-graph/35791/41 "2019-09-11T07:38:47Z")

</div>

Does your macro run ? it crashes for me …

---

<div class="post-metadata">

**Author:** ![jbmagallanes](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/jbmagallanes/32/20291_2.png) [@jbmagallanes](https://root-forum.cern.ch/u/jbmagallanes)\
**Post date:** [September 11, 2019, 11:02am UTC](https://root-forum.cern.ch/t/plotting-points-on-the-graph/35791/42 "2019-09-11T11:02:26Z")

</div>

It runs in mine… but I could not see the points of av0001… i don’t know why…

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [September 11, 2019, 11:23am UTC](https://root-forum.cern.ch/t/plotting-points-on-the-graph/35791/43 "2019-09-11T11:23:14Z")

</div>

I do not understand your code. You have:

```auto
 TF1 *lbs[nof];

```

Which declares an array of pointers to `TF1`

Then you do:

```auto
    av001->SetPoint(j, xpt, ypt + lbs[i]->Eval(xpt)/(Double_t)nof);

```

But what is `lbs[i]` ? … the function `lbs[i]` has never been defined seems to me …

Same thing for `lbc`, `les` and `lec` …

---

<div class="post-metadata">

**Author:** ![jbmagallanes](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/jbmagallanes/32/20291_2.png) [@jbmagallanes](https://root-forum.cern.ch/u/jbmagallanes)\
**Post date:** [September 13, 2019, 2:20am UTC](https://root-forum.cern.ch/t/plotting-points-on-the-graph/35791/44 "2019-09-13T02:20:33Z")

</div>

sorry… my mistake… it was defined, however, in the longer version of the code 🙂

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [September 13, 2019, 6:29am UTC](https://root-forum.cern.ch/t/plotting-points-on-the-graph/35791/45 "2019-09-13T06:29:11Z")

</div>

The graph has 0 point:

```auto
root [0] .x DataPointSample.C
Error in <TGraphPainter::PaintGraph>: illegal number of points (0)

```

That’s why you do not see it.

---

<div class="post-metadata">

**Author:** ![jbmagallanes](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/jbmagallanes/32/20291_2.png) [@jbmagallanes](https://root-forum.cern.ch/u/jbmagallanes)\
**Post date:** [September 14, 2019, 6:39am UTC](https://root-forum.cern.ch/t/plotting-points-on-the-graph/35791/46 "2019-09-14T06:39:06Z")

</div>

But i could see this:

```auto
x[97]=0.4838, y[97]=0.00089801
x[98]=0.488787, y[98]=0.000876956
x[99]=0.493775, y[99]=0.000856525
x[100]=0.498762, y[100]=0.000836693
x[101]=0.50375, y[101]=0.000817439
x[102]=0.508737, y[102]=0.000798742
x[103]=0.513725, y[103]=0.000780584

```

indeed, the value of x[100] of 0.498762 is a valid point in the x-axis… how could it be…

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [September 16, 2019, 9:11am UTC](https://root-forum.cern.ch/t/plotting-points-on-the-graph/35791/47 "2019-09-16T09:11:35Z")

</div>

> [@jbmagallanes](#):
>
> how could it be…

The test:

```auto
   if ( abs(xpt - 0.498762) < ept )

```

is never true.

---

<div class="post-metadata">

**Author:** ![jbmagallanes](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/jbmagallanes/32/20291_2.png) [@jbmagallanes](https://root-forum.cern.ch/u/jbmagallanes)\
**Post date:** [September 16, 2019, 9:44am UTC](https://root-forum.cern.ch/t/plotting-points-on-the-graph/35791/48 "2019-09-16T09:44:33Z")

</div>

I printed the points… that value was there… now, i do not know why… i tried using xpt==0.498762 but the same thing happens 🙂

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [September 16, 2019, 11:19am UTC](https://root-forum.cern.ch/t/plotting-points-on-the-graph/35791/49 "2019-09-16T11:19:16Z")

</div>

Make ept bigger (0.01) and you will see some points … (I told you the test I pointed is never true …)

---

<div class="post-metadata">

**Author:** ![jbmagallanes](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/jbmagallanes/32/20291_2.png) [@jbmagallanes](https://root-forum.cern.ch/u/jbmagallanes)\
**Post date:** [September 16, 2019, 2:28pm UTC](https://root-forum.cern.ch/t/plotting-points-on-the-graph/35791/50 "2019-09-16T14:28:02Z")

</div>

gracias for the enlightenment 🙂

---

<div class="post-metadata">

**Author:** ![jbmagallanes](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/jbmagallanes/32/20291_2.png) [@jbmagallanes](https://root-forum.cern.ch/u/jbmagallanes)\
**Post date:** [September 16, 2019, 2:37pm UTC](https://root-forum.cern.ch/t/plotting-points-on-the-graph/35791/51 "2019-09-16T14:37:05Z")

</div>

I am supposed to see 4 new points but I could only see 3 for this code:

[DataPointSample.C](https://root-forum.cern.ch/uploads/short-url/c018oAKdHnL8Y2st3uoFF1Hz56I.C) (90.1 KB)

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [September 16, 2019, 2:56pm UTC](https://root-forum.cern.ch/t/plotting-points-on-the-graph/35791/52 "2019-09-16T14:56:04Z")

</div>

Well, that’s your code… Regarding the code itself (c++ syntax etc… ) there is no mistakes. I guess it is up to you to check your data (you know them better than me) and the parameters settings (eps, ept …)

[Previous page](https://root-forum.cern.ch/t/plotting-points-on-the-graph/35791.md?page=2)
