# Draw TH2F with lego option and error bars

**URL:** <https://root-forum.cern.ch/t/draw-th2f-with-lego-option-and-error-bars/53950>\
**Category:** Newbie\
**Created:** [March 9, 2023, 12:04pm UTC](https://root-forum.cern.ch/t/draw-th2f-with-lego-option-and-error-bars/53950 "2023-03-09T12:04:11Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![rookie\_root](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/r/b782af/32.png) [@rookie\_root](https://root-forum.cern.ch/u/rookie_root)\
**Post date:** [March 9, 2023, 12:04pm UTC](https://root-forum.cern.ch/t/draw-th2f-with-lego-option-and-error-bars/53950/1 "2023-03-09T12:04:11Z")

</div>

Hi,

I would like to draw a TH2F lego style but with the errors shown. I tried to combine both the LEGO and E options but it does not seem to work, it is either or… (when I simply add the e after lego I do get some dots on the 3d columns, but not really the error bars). Is there a way to do it? Also when I use only the E option, the plot does not seem to change no matter which version (1, 2, 3 …) I use.

Thank you!

* * *

\_ROOT Version: 6.12/04  
\_Platform: MacOS 10.12.6,  
\_Compiler: clang 9.0

* * *

---

<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:** [March 9, 2023, 12:25pm UTC](https://root-forum.cern.ch/t/draw-th2f-with-lego-option-and-error-bars/53950/2 "2023-03-09T12:25:47Z")

</div>

```auto
hpxpy->Draw("e");
hpxpy->Draw("lego same");

```

 ![Screenshot 2023-03-09 at 13.26.06](https://root-forum.cern.ch/uploads/default/original/3X/9/6/96072726addc86cff88df1dd808be8b06e16f27d.jpeg)

---

<div class="post-metadata">

**Author:** ![rookie\_root](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/r/b782af/32.png) [@rookie\_root](https://root-forum.cern.ch/u/rookie_root)\
**Post date:** [March 9, 2023, 1:04pm UTC](https://root-forum.cern.ch/t/draw-th2f-with-lego-option-and-error-bars/53950/3 "2023-03-09T13:04:11Z")

</div>

So close I was, putting the order the other way around! 😄 thanks!

---

<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:** [March 9, 2023, 1:19pm UTC](https://root-forum.cern.ch/t/draw-th2f-with-lego-option-and-error-bars/53950/4 "2023-03-09T13:19:11Z")

</div>

@couet It seems to me that the “z” axes used by the “`e`” plot and the “`lego`” plot are different (the centers of the markers are always “below” the corresponding “box surfaces”).

---

<div class="post-metadata">

**Author:** ![rookie\_root](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/r/b782af/32.png) [@rookie\_root](https://root-forum.cern.ch/u/rookie_root)\
**Post date:** [March 9, 2023, 1:36pm UTC](https://root-forum.cern.ch/t/draw-th2f-with-lego-option-and-error-bars/53950/5 "2023-03-09T13:36:33Z")

</div>

Indeed, but for me with the “right” view it’s more or less ok.

 ![Screen Shot 2023-03-09 at 14.34.19](https://root-forum.cern.ch/uploads/default/original/3X/1/1/11e97ce545011330ed7d5496406255ee9050fda7.png)  
 ![Screen Shot 2023-03-09 at 14.34.37](https://root-forum.cern.ch/uploads/default/original/3X/e/1/e10dd77f65e13a7bd26bb266710e9d8c10378fb4.jpeg)

---

<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:** [March 9, 2023, 1:42pm UTC](https://root-forum.cern.ch/t/draw-th2f-with-lego-option-and-error-bars/53950/6 "2023-03-09T13:42:59Z")

</div>

@rookie_root If your errors are so small, do not use “`e`” at all (it just makes the whole picture less readable).

---

<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:** [March 9, 2023, 1:59pm UTC](https://root-forum.cern.ch/t/draw-th2f-with-lego-option-and-error-bars/53950/7 "2023-03-09T13:59:15Z")

</div>

Yes the overlap might not coincide exactly you better impose the min and max (SetMaximum, SetMinimum)
