# How to define histogram with variable bin width in python

**URL:** <https://root-forum.cern.ch/t/how-to-define-histogram-with-variable-bin-width-in-python/27110>\
**Category:** ROOT\
**Created:** [November 30, 2017, 6:02am UTC](https://root-forum.cern.ch/t/how-to-define-histogram-with-variable-bin-width-in-python/27110 "2017-11-30T06:02:17Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![wlav](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/w/f07891/32.png) [@wlav](https://root-forum.cern.ch/u/wlav)\
**Post date:** [November 30, 2017, 4:55pm UTC](https://root-forum.cern.ch/t/how-to-define-histogram-with-variable-bin-width-in-python/27110/3 "2017-11-30T16:55:30Z")

</div>

In defense of TS, the code won’t work with a list per the other topic but should do with a numpy array.

There was a recent thread and bug report about incorrect array converters being selected: the selection is on element size, not element type as numpy arrays don’t carry a typecode as an attribute (but do as part of the buffer info). See:

[https://sft.its.cern.ch/jira/browse/ROOT-9040](https://sft.its.cern.ch/jira/browse/ROOT-9040)  
[pyROOT TMultiGraph Segmentation Fault](https://root-forum.cern.ch/t/pyroot-tmultigraph-segmentation-fault/26263)

---

_[View the full topic](https://root-forum.cern.ch/t/how-to-define-histogram-with-variable-bin-width-in-python/27110)._
