# Unexpected behaviour for custom histogram limits in Gadfly

**URL:** <https://discourse.julialang.org/t/unexpected-behaviour-for-custom-histogram-limits-in-gadfly/45125>\
**Category:** General Usage\
**Tags:** package, plotting\
**Created:** [August 17, 2020, 7:19pm UTC](https://discourse.julialang.org/t/unexpected-behaviour-for-custom-histogram-limits-in-gadfly/45125 "2020-08-17T19:19:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![IMoronPirate](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/imoronpirate/32/33609_2.png) [@IMoronPirate](https://discourse.julialang.org/u/IMoronPirate)\
**Post date:** [August 17, 2020, 7:19pm UTC](https://discourse.julialang.org/t/unexpected-behaviour-for-custom-histogram-limits-in-gadfly/45125/1 "2020-08-17T19:19:53Z")

</div>

If one plots the histogram of some data in Gadfly everything works fine.

```julia
d = randn(250);
plot(x=d, Geom.histogram(bincount=35))

```

 ![image](https://global.discourse-cdn.com/julialang/original/3X/2/7/27d1197477d4b2f9db3bf2f0d9661e5abe6876af.png)

However, providing the limits to plot the histogram of data between -5 and 0

```julia
plot(x=d, Geom.histogram(bincount=35, limits=(min=-5, max=0)))

```

one does not get what expected since the whole distribution is still there but just shifted to the left, as shown below.

 ![image](https://global.discourse-cdn.com/julialang/original/3X/7/c/7c8179ee0c7eaa4693e5ecd94a3242d27fe1194a.png)

I would have expected the histogram to be displayed between `min` and `max` divided in `bincount` bins. Instead, this behavior of the `limits` parameter, is quite misleading since it changes the data one is trying to plot.

PS Gadfly v1.3.0

---

<div class="post-metadata">

**Author:** ![Mattriks](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mattriks/32/351_2.png) [@Mattriks](https://discourse.julialang.org/u/Mattriks)\
**Post date:** [August 18, 2020, 4:08am UTC](https://discourse.julialang.org/t/unexpected-behaviour-for-custom-histogram-limits-in-gadfly/45125/2 "2020-08-18T04:08:42Z")

</div>

That’s definitely a bug. Will fix.

---

<div class="post-metadata">

**Author:** ![IMoronPirate](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/imoronpirate/32/33609_2.png) [@IMoronPirate](https://discourse.julialang.org/u/IMoronPirate)\
**Post date:** [August 20, 2020, 7:40pm UTC](https://discourse.julialang.org/t/unexpected-behaviour-for-custom-histogram-limits-in-gadfly/45125/3 "2020-08-20T19:40:49Z")

</div>

Perfect, thanks.
