# GetPointY() doesn't work for TGraphAsymmErrors

**URL:** <https://root-forum.cern.ch/t/getpointy-doesnt-work-for-tgraphasymmerrors/38602>\
**Category:** Newbie\
**Created:** [March 28, 2020, 11:33am UTC](https://root-forum.cern.ch/t/getpointy-doesnt-work-for-tgraphasymmerrors/38602 "2020-03-28T11:33:29Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![evdv](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/e/2acd7d/32.png) [@evdv](https://root-forum.cern.ch/u/evdv)\
**Post date:** [March 28, 2020, 11:33am UTC](https://root-forum.cern.ch/t/getpointy-doesnt-work-for-tgraphasymmerrors/38602/1 "2020-03-28T11:33:29Z")

</div>

Hi all, I have a TGraphAsymmErrors object and I only want to plot it for y values that are above a certain value. In order to do this, I need to extract my y values from my function and compare them to that value and remove it if it is smaller. The problem is that I get an error saying that “there is no member named ‘GetPointY’ in ‘TGraphAsymmErrors’”. But GetPointY() is from the TGraph class and so I thought that it should also work for TGraphAsymmErrors, because I thought that this was ultimately still a TGraph object? Thanks!

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [March 28, 2020, 5:25pm UTC](https://root-forum.cern.ch/t/getpointy-doesnt-work-for-tgraphasymmerrors/38602/2 "2020-03-28T17:25:21Z")

</div>

Try: `graph->GetY()[i] /* 0 <= i < graph->GetN() */`

---

<div class="post-metadata">

**Author:** ![evdv](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/e/2acd7d/32.png) [@evdv](https://root-forum.cern.ch/u/evdv)\
**Post date:** [March 29, 2020, 10:58am UTC](https://root-forum.cern.ch/t/getpointy-doesnt-work-for-tgraphasymmerrors/38602/3 "2020-03-29T10:58:51Z")

</div>

Thanks! I don’t get that error anymore, but some other things are now going wrong… This is what I did:

```auto
auto graph = new TGraphAsymmErrors(); 
graph->Divide(h1, h2);
int N = graph->GetN();
std::vector<double> y_value(N); 
  
for (unsigned i = 0; i < N; i++) {
   y_value[i] = graph->GetY()[i]; 
   if (y_value[i] < 0.5) {
     graph->RemovePoint(); 
     }
  }
  graph->Draw("ap");

```

h1 and h2 are previously defined in my code and are both TH1D objects. when I try running my code there’s a “break segmentation violation”. Thanks!

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [March 29, 2020, 11:04am UTC](https://root-forum.cern.ch/t/getpointy-doesnt-work-for-tgraphasymmerrors/38602/4 "2020-03-29T11:04:03Z")

</div>

`for (int i = (N - 1); i >= 0; i--) {`

---

<div class="post-metadata">

**Author:** ![evdv](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/e/2acd7d/32.png) [@evdv](https://root-forum.cern.ch/u/evdv)\
**Post date:** [March 29, 2020, 12:40pm UTC](https://root-forum.cern.ch/t/getpointy-doesnt-work-for-tgraphasymmerrors/38602/5 "2020-03-29T12:40:40Z")

</div>

I am still getting break: Segmentation violation… 😕

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [March 29, 2020, 2:58pm UTC](https://root-forum.cern.ch/t/getpointy-doesnt-work-for-tgraphasymmerrors/38602/6 "2020-03-29T14:58:18Z")

</div>

I missed: `graph->RemovePoint(i);`

---

<div class="post-metadata">

**Author:** ![evdv](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/e/2acd7d/32.png) [@evdv](https://root-forum.cern.ch/u/evdv)\
**Post date:** [March 30, 2020, 10:10am UTC](https://root-forum.cern.ch/t/getpointy-doesnt-work-for-tgraphasymmerrors/38602/7 "2020-03-30T10:10:57Z")

</div>

It works! Thanks a lot!
