# Trying to use ProjectionY on TGraph

**URL:** <https://root-forum.cern.ch/t/trying-to-use-projectiony-on-tgraph/54090>\
**Category:** Newbie\
**Tags:** root\
**Created:** [March 17, 2023, 4:48pm UTC](https://root-forum.cern.ch/t/trying-to-use-projectiony-on-tgraph/54090 "2023-03-17T16:48:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Goktug\_Bayram](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/goktug_bayram/32/31211_2.png) [@Goktug\_Bayram](https://root-forum.cern.ch/u/Goktug_Bayram)\
**Post date:** [March 17, 2023, 4:48pm UTC](https://root-forum.cern.ch/t/trying-to-use-projectiony-on-tgraph/54090/1 "2023-03-17T16:48:32Z")

</div>

Dear experts,  
I have a txt data about my project. I can read and draw this data with TGraph. I want to fit certain range of my data. I have a chart and I want to fit only the min and max values ​​of this chart. I’m using the ProjectionY command, but I’m getting an error from the terminal.

TGraph \*graph2 = new TGraph(“5Mv\_CH3.txt”);  
graph2-\> ProjectionY()-\>Draw();

For now I am trying to get Y axis. But it seems like ProjectionY doesn’t even work.

Regards.  
 ![..png](https://root-forum.cern.ch/uploads/default/original/3X/4/2/42ff89d5d68ce96e0b679a093bf01eeb5128a706.png)

---

<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 17, 2023, 4:53pm UTC](https://root-forum.cern.ch/t/trying-to-use-projectiony-on-tgraph/54090/2 "2023-03-17T16:53:27Z")

</div>

[TGraph](https://root.cern/doc/master/classTGraph.html)
