# Fill a histogram with different colors for different fit functions

**URL:** <https://root-forum.cern.ch/t/fill-a-histogram-with-different-colors-for-different-fit-functions/46802>\
**Category:** Newbie\
**Created:** [September 13, 2021, 3:47am UTC](https://root-forum.cern.ch/t/fill-a-histogram-with-different-colors-for-different-fit-functions/46802 "2021-09-13T03:47:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![paulan](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/p/b77776/32.png) [@paulan](https://root-forum.cern.ch/u/paulan)\
**Post date:** [September 13, 2021, 3:47am UTC](https://root-forum.cern.ch/t/fill-a-histogram-with-different-colors-for-different-fit-functions/46802/1 "2021-09-13T03:47:06Z")

</div>

Hi, I have a histogram on which I have fitted two functions (one for bkg, the other is bkg+signal) as attached. I would like to fill the histogram with a different colour under the background fit function (the red line here). How could I possibly do so?

_ROOT Version:_ 6.24/02

 ![hist](https://root-forum.cern.ch/uploads/default/original/3X/e/6/e647fbdc5881c700febbdbfc4f914874dc2d2e12.png)

* * *

---

<div class="post-metadata">

**Author:** ![dastudillo](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/dastudillo/32/17280_2.png) [@dastudillo](https://root-forum.cern.ch/u/dastudillo)\
**Post date:** [September 13, 2021, 4:00am UTC](https://root-forum.cern.ch/t/fill-a-histogram-with-different-colors-for-different-fit-functions/46802/2 "2021-09-13T04:00:27Z")

</div>

If your fit function is f1, you can try something like

```auto
   f1->SetFillStyle(1001);
   f1->SetFillColor(kRed);

```

check out the fill styles in the [TAttFill](https://root.cern/doc/master/classTAttFill.html) docs.
