# Histogram 'calculate average' bug?

**URL:** https://discourse.paraview.org/t/histogram-calculate-average-bug/5100
**Category:** ParaView Support
**Created:** [August 12, 2020, 6:48pm UTC](https://discourse.paraview.org/t/histogram-calculate-average-bug/5100 "2020-08-12T18:48:02Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![dannykhf](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/d/c67d28/32.png) [@dannykhf](https://discourse.paraview.org/u/dannykhf)
#### Post date: [August 12, 2020, 6:48pm UTC](https://discourse.paraview.org/t/histogram-calculate-average-bug/5100/1 "2020-08-12T18:48:02Z")

</div>

It notice in Paraview 5.8 that when I use histogram and the calculate average option after a clip, the calculate average data would return junk if the bin size is large enough. Is this a bug?

Data looks ok in the histogram before the clip

 ![histo1](https://discourse.paraview.org/uploads/default/original/2X/1/15423c7082b115c883cbec7817e0384b7eb21bf3.png)

Same setting of histogram on a clipped data. Note the junk data generated.

 ![histo2](https://discourse.paraview.org/uploads/default/original/2X/8/8b04b449264b1bfc9b9ed048883c4438a4156e8e.png)

Example test state file based on ([Create spheres from data containing positions and radius](https://discourse.paraview.org/t/create-spheres-from-data-containing-positions-and-radius/3370/4))  
[debug-histogram.pvsm](https://discourse.paraview.org/uploads/short-url/y1tekou4ItND5FO9S5iZzYWlqXK.pvsm) (569.8 KB)  
[example-points.csv](https://discourse.paraview.org/uploads/short-url/rqVBg1fAZoMKsavvAabyPG4jTax.csv) (343 Bytes)

---

<div class="post-metadata">

### Author: ![dannykhf](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/d/c67d28/32.png) [@dannykhf](https://discourse.paraview.org/u/dannykhf)
#### Post date: [August 13, 2020, 1:05am UTC](https://discourse.paraview.org/t/histogram-calculate-average-bug/5100/2 "2020-08-13T01:05:51Z")

</div>

I tried couple more times, loading the state file directly may not result the error. One may need to change the number of bin (ex: from 500 to 1000) to see the junk data.

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [August 31, 2020, 9:44am UTC](https://discourse.paraview.org/t/histogram-calculate-average-bug/5100/3 "2020-08-31T09:44:14Z")

</div>

There is definitelly something going on. It seems to be linked to the custom bin range min being 0.

Can you try finding a simpler way to reproduce the issue ?

---

<div class="post-metadata">

### Author: ![wyldckat](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/w/c6cbf5/32.png) [@wyldckat](https://discourse.paraview.org/u/wyldckat)
#### Post date: [June 21, 2023, 3:44pm UTC](https://discourse.paraview.org/t/histogram-calculate-average-bug/5100/4 "2023-06-21T15:44:44Z")

</div>

Sorry for somewhat necro-bumping this thread, but it’s the only one I found with a similar complaint to what I discovered.

I’ve partially isolated the reason for this issue and have reported it here, along with another smaller test file and respective save state for ParaView: [https://gitlab.kitware.com/vtk/vtk/-/issues/19016](https://gitlab.kitware.com/vtk/vtk/-/issues/19016)
