# Show empty bins with 2d Gadfly histogram?

**URL:** <https://discourse.julialang.org/t/show-empty-bins-with-2d-gadfly-histogram/67056>\
**Category:** General Usage\
**Tags:** gadfly\
**Created:** [August 26, 2021, 8:32pm UTC](https://discourse.julialang.org/t/show-empty-bins-with-2d-gadfly-histogram/67056 "2021-08-26T20:32:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![thompsonmj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thompsonmj/32/25172_2.png) [@thompsonmj](https://discourse.julialang.org/u/thompsonmj)\
**Post date:** [August 26, 2021, 8:32pm UTC](https://discourse.julialang.org/t/show-empty-bins-with-2d-gadfly-histogram/67056/1 "2021-08-26T20:32:58Z")

</div>

Can’t find it anywhere in the docs, so I guess this isn’t possible with hex or square bins?

---

<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 27, 2021, 1:50am UTC](https://discourse.julialang.org/t/show-empty-bins-with-2d-gadfly-histogram/67056/2 "2021-08-27T01:50:29Z")

</div>

Yes empty bins are hidden by default, and currently there’s no `Geom.histogram2d` argument to switch that. A workaround is to use a background `Geom.rect`:

```julia
using RDatasets
geyser = dataset("datasets","faithful")
plot(geyser, x=:Eruptions, y=:Waiting, Scale.color_continuous(minvalue=0),
  Geom.histogram2d(xbincount=30, ybincount=30),
  layer(xmin=[1.6], xmax=[5.2], ymin=[43], ymax=[96], Geom.rect, 
    color=[colorant"midnightblue"])
)

```

![geyser](https://global.discourse-cdn.com/julialang/original/3X/b/8/b87d85152c944b913c3f050797c35a4c2613a06c.png)
