# 2D fitting using TGraph2DErrors

**URL:** <https://root-forum.cern.ch/t/2d-fitting-using-tgraph2derrors/46012>\
**Category:** ROOT\
**Created:** [July 26, 2021, 4:21pm UTC](https://root-forum.cern.ch/t/2d-fitting-using-tgraph2derrors/46012 "2021-07-26T16:21:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![olinpinto](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/olinpinto/32/25738_2.png) [@olinpinto](https://root-forum.cern.ch/u/olinpinto)\
**Post date:** [July 26, 2021, 4:21pm UTC](https://root-forum.cern.ch/t/2d-fitting-using-tgraph2derrors/46012/1 "2021-07-26T16:21:44Z")

</div>

Hello,

I am using TGraph2DErrors. And after performing **2D fitting with a lego2** as a draw option. I wondered if one can plot something like the relative difference between data and fit (so (data - fit)/fit) for the 2D point? Or maybe root provides already something useful?. As I find it rather hard to really judge it from the 2D plots.

Thank you in advance!

\_ROOT Version:6.08.00  
\_Compiler:x86\_64\_gcc48\_sl6

---

<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:** [July 27, 2021, 6:48am UTC](https://root-forum.cern.ch/t/2d-fitting-using-tgraph2derrors/46012/2 "2021-07-27T06:48:14Z")

</div>

There is no “ready to use” such tool (drawing option). You will need to make a new TGraph2D or TH2D made with the result of this difference.

---

<div class="post-metadata">

**Author:** ![Axel](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/axel/32/11084_2.png) [@Axel](https://root-forum.cern.ch/u/Axel)\
**Post date:** [July 29, 2021, 9:21pm UTC](https://root-forum.cern.ch/t/2d-fitting-using-tgraph2derrors/46012/3 "2021-07-29T21:21:44Z")

</div>

…and that’s indeed a recurrent request, something we should address on the ROOT side, be it within the upcoming RHist interfaces. @moneta is there an obvious TH2 alternative that you’re aware of? Residuals from TFitResult maybe?

---

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [August 3, 2021, 9:36am UTC](https://root-forum.cern.ch/t/2d-fitting-using-tgraph2derrors/46012/4 "2021-08-03T09:36:51Z")

</div>

We have the `TRatioPlot` but works for only 1D object. We could extend for the 2D case.

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [August 17, 2021, 9:37am UTC](https://root-forum.cern.ch/t/2d-fitting-using-tgraph2derrors/46012/5 "2021-08-17T09:37:42Z")

</div>

Closed on August 17, 2021, 9:37am UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
