# Getting the x-value in 2D histogram

**URL:** <https://root-forum.cern.ch/t/getting-the-x-value-in-2d-histogram/50077>\
**Category:** ROOT\
**Created:** [May 23, 2022, 4:14pm UTC](https://root-forum.cern.ch/t/getting-the-x-value-in-2d-histogram/50077 "2022-05-23T16:14:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![wfelix](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/w/a8b319/32.png) [@wfelix](https://root-forum.cern.ch/u/wfelix)\
**Post date:** [May 23, 2022, 4:14pm UTC](https://root-forum.cern.ch/t/getting-the-x-value-in-2d-histogram/50077/1 "2022-05-23T16:14:47Z")

</div>

Hello everyone,

this is a rather simple question I guess. I have a two dimensional histogram given. Basically, all I want to do is to get, for a given y bin, the corresponding x bin.

![Screenshot 2022-05-23 at 18.14.06](https://root-forum.cern.ch/uploads/default/original/3X/8/e/8eecd2b51fc4052d256530b5f0ee5e1df8fb871b.png)

However, I don’t think options like GetBinContent are sufficient… Any ideas?

---

<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:** [May 23, 2022, 4:32pm UTC](https://root-forum.cern.ch/t/getting-the-x-value-in-2d-histogram/50077/2 "2022-05-23T16:32:17Z")

</div>

Did you try?  
[https://root.cern/doc/master/classTH2.html](https://root.cern/doc/master/classTH2.html)  
search for GetBinContent.

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [June 6, 2022, 4:32pm UTC](https://root-forum.cern.ch/t/getting-the-x-value-in-2d-histogram/50077/3 "2022-06-06T16:32:21Z")

</div>

Closed on June 6, 2022, 4:32pm UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
