# Residual plot with TGraphErrors Object

**URL:** <https://root-forum.cern.ch/t/residual-plot-with-tgrapherrors-object/41326>\
**Category:** Newbie\
**Created:** [September 7, 2020, 8:42pm UTC](https://root-forum.cern.ch/t/residual-plot-with-tgrapherrors-object/41326 "2020-09-07T20:42:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Edward\_Finkelstein](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/edward_finkelstein/32/20070_2.png) [@Edward\_Finkelstein](https://root-forum.cern.ch/u/Edward_Finkelstein)\
**Post date:** [September 7, 2020, 8:42pm UTC](https://root-forum.cern.ch/t/residual-plot-with-tgrapherrors-object/41326/1 "2020-09-07T20:42:32Z")

</div>

Hello,  
I am trying to make a residual plot of point-fit/error, but I am using TGraphErrors object, so it doesn’t work the same way as with TH1F. Does somebody know how to do it?  
[alpha\_0\_beta\_and\_C01.cxx](https://root-forum.cern.ch/uploads/short-url/rvH37w5KQEJzjqcWpLWZIBJ9g74.cxx) (3.5 KB) [alpha\_0\_beta\_and\_C01.txt](https://root-forum.cern.ch/uploads/short-url/eTSYpM3vTFBgxwMGnizsP3B2f4v.txt) (783 Bytes)

ROOT Version: 6.23/01

---

<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:** [September 8, 2020, 7:18am UTC](https://root-forum.cern.ch/t/residual-plot-with-tgrapherrors-object/41326/2 "2020-09-08T07:18:27Z")

</div>

I see that pad2 is empty. But you draw nothing in it … so that’s expected.  
Your macro gives me the following plot:

 ![Screenshot 2020-09-08 at 09.17.30](https://root-forum.cern.ch/uploads/default/original/3X/a/3/a366a916206d510b13300d4eb26ecba987c5a401.jpeg)

---

<div class="post-metadata">

**Author:** ![Edward\_Finkelstein](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/edward_finkelstein/32/20070_2.png) [@Edward\_Finkelstein](https://root-forum.cern.ch/u/Edward_Finkelstein)\
**Post date:** [September 9, 2020, 2:54am UTC](https://root-forum.cern.ch/t/residual-plot-with-tgrapherrors-object/41326/3 "2020-09-09T02:54:31Z")

</div>

@couet  
So I made a separate file for histogram data to use for the residuals called dummy1.txt (since I see no other way to do it).  
I still have some formatting issues.

1. The y-axis label on my runner plot is too high.
2. I want the runner plot to span the same width that my main plot does, but now it is not so.
3. I am not sure if the residual plot I made is really plotting data-fit/bin\_error.

Maybe you can help?

[alpha\_0\_beta\_and\_C01.cxx](https://root-forum.cern.ch/uploads/short-url/qwwzbuX9n7KvU1Jzrbjb7qOJnL6.cxx) (4.2 KB)  
[alpha\_0\_beta\_and\_C01.txt](https://root-forum.cern.ch/uploads/short-url/nY9xxk5y5UrAvtkPB7UB086JlOg.txt) (785 Bytes)  
[dummy1.txt](https://root-forum.cern.ch/uploads/short-url/89bjyVUbBAeLKITAPWHY5Oq4JIk.txt) (9.8 KB)

---

<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:** [September 9, 2020, 9:19am UTC](https://root-forum.cern.ch/t/residual-plot-with-tgrapherrors-object/41326/4 "2020-09-09T09:19:21Z")

</div>

You are double posting … one is enough …

> [@Formatting Problems](https://root-forum.cern.ch/t/formatting-problems/41347):
>
> Hello, I am making a plot and a residual plot. I am having some formatting problems. The y-axis label on my runner plot is too high. I want the runner plot to span the same width that my main plot does, but now it is not so. I am not sure if the residual plot I made is really plotting data-fit/bin\_error. Any help is greatly appreciated. [dummy1.txt](https://root-forum.cern.ch/uploads/short-url/89bjyVUbBAeLKITAPWHY5Oq4JIk.txt) (9.8 KB) [alpha\_0\_beta\_and\_C01.txt](https://root-forum.cern.ch/uploads/short-url/nY9xxk5y5UrAvtkPB7UB086JlOg.txt) (785 Bytes) [alpha\_0\_beta\_and\_C01.cxx](https://root-forum.cern.ch/uploads/short-url/gGjFrhp4pEwQU1SGQFIRECsSvxS.cxx) (4.1 KB) ROOT Version: 6.23/01
