# Graph with errors from RDataFrame

**URL:** <https://root-forum.cern.ch/t/graph-with-errors-from-rdataframe/52841>\
**Category:** Newbie\
**Tags:** rdataframe\
**Created:** [December 21, 2022, 4:10am UTC](https://root-forum.cern.ch/t/graph-with-errors-from-rdataframe/52841 "2022-12-21T04:10:14Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![lilina](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/lilina/32/28468_2.png) [@lilina](https://root-forum.cern.ch/u/lilina)\
**Post date:** [January 20, 2023, 5:11pm UTC](https://root-forum.cern.ch/t/graph-with-errors-from-rdataframe/52841/7 "2023-01-20T17:11:06Z")

</div>

Thanks Enrico,

I found an example here [ROOT: tutorials/dataframe/df005\_fillAnyObject.C File Reference](https://root.cern.ch/doc/master/df005__fillAnyObject_8C.html) on how to use the Fill method but I could not figure out how to use it on TGraphErrors since I don’t find this class to expose a `Fill` method. But following this post [Coloured scatterplot from TDataFrame - #2 by eguiraud](https://root-forum.cern.ch/t/coloured-scatterplot-from-tdataframe/26894/2) I could make the TGraphErrors from the dataframe:

```auto
TGraphErrors* gtrue;

auto fillTrueValuesGraph = [&gtrue](int set, double y, double err_y){
      gtrue->SetPoint(gtrue->GetN(), set, y);
      gtrue->SetPointError( gtrue->GetN()-1, 0, err_y );
   };

df.Foreach(fillTrueValuesGraph, {"set", "y", "err_y"});

```

---

_[View the full topic](https://root-forum.cern.ch/t/graph-with-errors-from-rdataframe/52841)._
