# Smoothen a histogram

**URL:** <https://root-forum.cern.ch/t/smoothen-a-histogram/58815>\
**Category:** Newbie\
**Created:** [April 2, 2024, 4:49am UTC](https://root-forum.cern.ch/t/smoothen-a-histogram/58815 "2024-04-02T04:49:26Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sandy](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/2bfe46/32.png) [@Sandy](https://root-forum.cern.ch/u/Sandy)\
**Post date:** [April 2, 2024, 4:49am UTC](https://root-forum.cern.ch/t/smoothen-a-histogram/58815/1 "2024-04-02T04:49:27Z")

</div>

Hello,

Could somebody please tell me how to smoothen the attached 2D histogram where the visible lines (inside the red ellipse) would not be there in that way…

[Will the rebinning help?]

![2D](https://root-forum.cern.ch/uploads/default/original/3X/a/4/a4991bef452aa48530a014f19c7f2eab02986024.png)

Thanks

---

<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:** [April 2, 2024, 5:21am UTC](https://root-forum.cern.ch/t/smoothen-a-histogram/58815/2 "2024-04-02T05:21:18Z")

</div>

Maybe you can try [SetNumberContours](https://root.cern/doc/master/classTHistPainter.html#HP14), but the difference in values seems to big and your plot will probably lose a lot of detail. If you know that those are for instance “badly collected” data, you might want to filter them out before filling the histogram.

---

<div class="post-metadata">

**Author:** ![Sandy](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/2bfe46/32.png) [@Sandy](https://root-forum.cern.ch/u/Sandy)\
**Post date:** [April 3, 2024, 6:30am UTC](https://root-forum.cern.ch/t/smoothen-a-histogram/58815/3 "2024-04-03T06:30:26Z")

</div>

Hi @dastudillo

Thanks for your reply. I guess there are less events inside the ellipse. It would be better if it can be smoothen without losing the detail. Rebinning is helping but at the cost of resolution.

---

<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:** [April 3, 2024, 7:04am UTC](https://root-forum.cern.ch/t/smoothen-a-histogram/58815/4 "2024-04-03T07:04:39Z")

</div>

As @dastudillo suggested. it looks like your data are like that and there not much we can do at drawing time. May be you should consider looking at the way your histogram is filled and why such data show up.

---

<div class="post-metadata">

**Author:** ![Sandy](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/2bfe46/32.png) [@Sandy](https://root-forum.cern.ch/u/Sandy)\
**Post date:** [April 3, 2024, 9:38am UTC](https://root-forum.cern.ch/t/smoothen-a-histogram/58815/5 "2024-04-03T09:38:36Z")

</div>

Hi @couet

Ok. I shall check that. Thanks.
