# Histogram with specified bins and counts

**URL:** <https://community.plotly.com/t/histogram-with-specified-bins-and-counts/4772>\
**Category:** plotly.js\
**Created:** [July 4, 2017, 9:51pm UTC](https://community.plotly.com/t/histogram-with-specified-bins-and-counts/4772 "2017-07-04T21:51:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mlline00](https://avatars.discourse-cdn.com/v4/letter/m/e9bcb4/32.png) [@mlline00](https://community.plotly.com/u/mlline00)\
**Post date:** [July 4, 2017, 9:51pm UTC](https://community.plotly.com/t/histogram-with-specified-bins-and-counts/4772/1 "2017-07-04T21:51:02Z")

</div>

Is there a way to display a histogram where the bin edges and counts are already defined by upstream analytic algorithms? I hope I’m not missing something obvious, but I don’t see a way to accomplish this with a histogram trace. I’ve started trying to present this data in a bar chart, but want to make sure I’m not jumping through hoops unnecessarily.

Thanks for any help on this.

---

<div class="post-metadata">

**Author:** ![etienne](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/etienne/32/17_2.png) [@etienne](https://community.plotly.com/u/etienne)\
**Post date:** [July 5, 2017, 2:08pm UTC](https://community.plotly.com/t/histogram-with-specified-bins-and-counts/4772/2 "2017-07-05T14:08:28Z")

</div>

You can set:

![](https://us1.discourse-cdn.com/flex024/uploads/plot/original/2X/6/62e1367679c86ef5f8d0fb00afcfe77f0a4d57f7.png)

from [https://plot.ly/javascript/reference/#histogram-xbins](https://plot.ly/javascript/reference/#histogram-xbins)

If that isn’t ideal for you, I’d recommend creating a `bar` trace with your computed data.
