# Suggestion for new TGraph Constructor

**URL:** <https://root-forum.cern.ch/t/suggestion-for-new-tgraph-constructor/15198>\
**Category:** ROOT\
**Created:** [November 5, 2012, 6:09pm UTC](https://root-forum.cern.ch/t/suggestion-for-new-tgraph-constructor/15198 "2012-11-05T18:09:08Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![jfcaron](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/j/7c8e57/32.png) [@jfcaron](https://root-forum.cern.ch/u/jfcaron)\
**Post date:** [November 5, 2012, 6:09pm UTC](https://root-forum.cern.ch/t/suggestion-for-new-tgraph-constructor/15198/1 "2012-11-05T18:09:08Z")

</div>

Hello, I notice that TVector objects have a .Draw() method that makes a graph for visualization, with automatic X-values from the index, and Y-values from the values in the TVector itself.

I am hoping that we can add a constructor for TGraph that duplicates this behavior, so that one can do

```auto
TVectorD tv(10);
for(Int_t i = 0;i<10;i++){tv[i] = i*i+3;}
TGraph tg(10,tv);
```

and that the resulting TGraph would look like the result of tv.Draw().

Is this possible?

Jean-François

---

_[View the full topic](https://root-forum.cern.ch/t/suggestion-for-new-tgraph-constructor/15198)._
