# Color of the confidence Interval in TRatioPlot

**URL:** <https://root-forum.cern.ch/t/color-of-the-confidence-interval-in-tratioplot/46351>\
**Category:** Newbie\
**Created:** [August 19, 2021, 10:09am UTC](https://root-forum.cern.ch/t/color-of-the-confidence-interval-in-tratioplot/46351 "2021-08-19T10:09:52Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chandradoy\_Chatterje](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/chandradoy_chatterje/32/27148_2.png) [@Chandradoy\_Chatterje](https://root-forum.cern.ch/u/Chandradoy_Chatterje)\
**Post date:** [August 19, 2021, 10:09am UTC](https://root-forum.cern.ch/t/color-of-the-confidence-interval-in-tratioplot/46351/1 "2021-08-19T10:09:52Z")

</div>

Dear ROOT experts,  
I am using the TRatioPlot to see the fit residual of a fitted histogram. I was checking the code of the color and I found in line 622 and 623 of TRatioPlot.cxx the color of the intervals are swapped.  
Namely,  
fConfidenceInterval2-\>SetFillColor(fCi1Color);  
fConfidenceInterval1-\>SetFillColor(fCi2Color);  
Why is it so?

---

<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:** [August 19, 2021, 11:00am UTC](https://root-forum.cern.ch/t/color-of-the-confidence-interval-in-tratioplot/46351/2 "2021-08-19T11:00:47Z")

</div>

[Line 622](https://github.com/root-project/root/blob/eb7c9c44465ad3f8db90d83598e3116a45ca630e/graf2d/gpad/src/TRatioPlot.cxx#L622) of TRatioPlot.cxx is not what you say. May be you are looking at an old version ?

---

<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:** [August 19, 2021, 11:04am UTC](https://root-forum.cern.ch/t/color-of-the-confidence-interval-in-tratioplot/46351/3 "2021-08-19T11:04:06Z")

</div>

@couet How about the line 601? 😉

---

<div class="post-metadata">

**Author:** ![Chandradoy\_Chatterje](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/chandradoy_chatterje/32/27148_2.png) [@Chandradoy\_Chatterje](https://root-forum.cern.ch/u/Chandradoy_Chatterje)\
**Post date:** [August 19, 2021, 11:12am UTC](https://root-forum.cern.ch/t/color-of-the-confidence-interval-in-tratioplot/46351/4 "2021-08-19T11:12:34Z")

</div>

Yes, I am looking to ROOT 6.08/07, the version I was using. But, the link you sent has the same issue in line 601 and 602 as mentioned by @Wile_E_Coyote.

---

<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:** [August 19, 2021, 11:41am UTC](https://root-forum.cern.ch/t/color-of-the-confidence-interval-in-tratioplot/46351/5 "2021-08-19T11:41:31Z")

</div>

On [this plot](https://root.cern/doc/master/classTRatioPlot.html#a768873a7064ebba3a270db83f40dd946) are the colours inverted compare to the documentation description ?

---

<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:** [August 19, 2021, 11:53am UTC](https://root-forum.cern.ch/t/color-of-the-confidence-interval-in-tratioplot/46351/6 "2021-08-19T11:53:47Z")

</div>

I went back in the code history. Initially the colours were not settable and the code was:

```auto
     fConfidenceInterval2->SetFillColor(kGreen);
     fConfidenceInterval1->SetFillColor(kYellow);

```

The colours were hardcoded. The outside was green and the inside yellow. With the new code the outside is also green and the inside yellow. So the default are correct. Therefore it is not enough to change the two colours indices. The default values should also be changed.

---

<div class="post-metadata">

**Author:** ![Chandradoy\_Chatterje](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/chandradoy_chatterje/32/27148_2.png) [@Chandradoy\_Chatterje](https://root-forum.cern.ch/u/Chandradoy_Chatterje)\
**Post date:** [August 19, 2021, 11:59am UTC](https://root-forum.cern.ch/t/color-of-the-confidence-interval-in-tratioplot/46351/7 "2021-08-19T11:59:08Z")

</div>

This is my impression. If you look the two parameters ci1 and ci2 are respectively, they are respectively the color of confidence level of 1 sigma and 2sigma respectively. I intuitively guess that 1 sigma C.L. is narrower than 2 sigma C.L. (I am not 100% sure). The default color scheme in my understanding is kGreen for 1 sigma CL and kYellow for 2 Sigma CL. Which is the parameter in your attached example.

I was therefore looking into the color scheme in the .cxx file. There I found in the part where the code is filling colors of the confidence intervals it is filling the color assigned to the 1 sigma one into CL2 and 2 sigma one into CL1. This is what made me puzzled.

---

<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:** [August 19, 2021, 12:01pm UTC](https://root-forum.cern.ch/t/color-of-the-confidence-interval-in-tratioplot/46351/8 "2021-08-19T12:01:40Z")

</div>

I think you are right. I will make a PR. Thanks to have seen it.

---

<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:** [August 19, 2021, 1:19pm UTC](https://root-forum.cern.ch/t/color-of-the-confidence-interval-in-tratioplot/46351/9 "2021-08-19T13:19:31Z")

</div>

PR: [Fix colour issue for TRatioPlot by couet · Pull Request #8872 · root-project/root · GitHub](https://github.com/root-project/root/pull/8872)
