# Why I am getting long error bars?

**URL:** <https://root-forum.cern.ch/t/why-i-am-getting-long-error-bars/52377>\
**Category:** Newbie\
**Created:** [November 15, 2022, 5:47pm UTC](https://root-forum.cern.ch/t/why-i-am-getting-long-error-bars/52377 "2022-11-15T17:47:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dil](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/dil/32/26887_2.png) [@Dil](https://root-forum.cern.ch/u/Dil)\
**Post date:** [November 15, 2022, 5:47pm UTC](https://root-forum.cern.ch/t/why-i-am-getting-long-error-bars/52377/1 "2022-11-15T17:47:01Z")

</div>

Hello Rooters,  
I am getting a few long error bars. This cause my plot looks weird.Cannot even see the shape of the plot.  
What’s the reason for this or any way to get rid of these long error bars?

Here is my plot.

```auto
h_mppi->Fill(pipi_mass, model)

```

Could you please help me to understand this?

thank You

 ![Screen Shot 2022-11-15 at 12.42.33 PM](https://root-forum.cern.ch/uploads/default/original/3X/0/d/0dd5e7f1a1c67ef1e386d5aecee41593871aa7d0.png)

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [November 16, 2022, 8:03am UTC](https://root-forum.cern.ch/t/why-i-am-getting-long-error-bars/52377/2 "2022-11-16T08:03:54Z")

</div>

I guess @couet can give you the information you’re looking for

---

<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:** [November 16, 2022, 8:17am UTC](https://root-forum.cern.ch/t/why-i-am-getting-long-error-bars/52377/3 "2022-11-16T08:17:24Z")

</div>

@moneta might know better, but could it be that the bins with long error bars are some filled only a very few times with some weight?

---

<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:** [November 16, 2022, 9:19am UTC](https://root-forum.cern.ch/t/why-i-am-getting-long-error-bars/52377/4 "2022-11-16T09:19:24Z")

</div>

Hi,  
The large errors are caused by the fact that these entries are filled with a large weight. If you just want just to set the content for each bin, you can use `TH1::SetBinContent` instead of `TH1::Fill` or not plotting the errors, using the `"hist"` option when plotting.

Lorenzo

---

<div class="post-metadata">

**Author:** ![Dil](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/dil/32/26887_2.png) [@Dil](https://root-forum.cern.ch/u/Dil)\
**Post date:** [November 16, 2022, 2:33pm UTC](https://root-forum.cern.ch/t/why-i-am-getting-long-error-bars/52377/5 "2022-11-16T14:33:56Z")

</div>

Thanks for the answers. Should try these.
