# Making an histogram showing bin content from data file

**URL:** <https://root-forum.cern.ch/t/making-an-histogram-showing-bin-content-from-data-file/47607>\
**Category:** Newbie\
**Created:** [November 10, 2021, 6:03am UTC](https://root-forum.cern.ch/t/making-an-histogram-showing-bin-content-from-data-file/47607 "2021-11-10T06:03:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alberto\_Navarro](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/alberto_navarro/32/24039_2.png) [@Alberto\_Navarro](https://root-forum.cern.ch/u/Alberto_Navarro)\
**Post date:** [November 10, 2021, 6:03am UTC](https://root-forum.cern.ch/t/making-an-histogram-showing-bin-content-from-data-file/47607/1 "2021-11-10T06:03:59Z")

</div>

Hello,

I have a set of data in a text file with three columns and I want to make a plot/histogram like the one shown below ![Screenshot from 2021-11-09 21-34-41](https://root-forum.cern.ch/uploads/default/original/3X/2/2/2296cc4bda0bf27877334f089fea440fccf828f0.jpeg)

I would appreciate some help to identify this kind of plot and the ROOT class I should use, so I can try to reproduce it.

Thanks

_ROOT Version:_ 6.24/01  
_Platform:_ Ubuntu 21.04  
_Compiler:_ Not Provided

* * *

---

<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:** [November 10, 2021, 6:56am UTC](https://root-forum.cern.ch/t/making-an-histogram-showing-bin-content-from-data-file/47607/2 "2021-11-10T06:56:32Z")

</div>

[THistPainter → Options supported for 2D histograms](https://root.cern/doc/master/classTHistPainter.html#HP01c)  
[THistPainter → The TEXT and TEXTnn Option](https://root.cern/doc/master/classTHistPainter.html#HP15)  
[TColor → Color palettes](https://root.cern/doc/master/classTColor.html#C05)

---

<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 10, 2021, 7:56am UTC](https://root-forum.cern.ch/t/making-an-histogram-showing-bin-content-from-data-file/47607/3 "2021-11-10T07:56:26Z")

</div>

Basically you need to do:

```auto
your_2d_histo->Draw("colz text")

```

---

<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:** [November 10, 2021, 7:59am UTC](https://root-forum.cern.ch/t/making-an-histogram-showing-bin-content-from-data-file/47607/4 "2021-11-10T07:59:30Z")

</div>

@couet you forgot to set the right palette 😉

---

<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 10, 2021, 8:04am UTC](https://root-forum.cern.ch/t/making-an-histogram-showing-bin-content-from-data-file/47607/5 "2021-11-10T08:04:08Z")

</div>

Indeed … 😉  
And the text color too… So:

```auto
 gStyle->SetPalette(kDarkBodyRadiator);
 your_2d_histo->SetMarkerColor(kWhite);
 your_2d_histo->Draw("colz text");

```
