matplotlib/matplotlib — Issue #609: Large values in histograms not showing
Author: LeoBreebaart
Created: 2011-12-06 17:20:39+00:00
State: open

I posted this to matplotlib-users, and was asked to file a bug for it. So:

It would appear that Axes.hist() does not handle large input
values the way I was expecting it to.

For example:

import matplotlib.pyplot as plt

fig = plt.figure()
ax = fig.add_subplot(111)
# Plot as expected: single bar in the center:
#result = ax.hist([1.0e+14], 5)
# Plot remains completely empty:
result = ax.hist([1.0e+16], 5)
print "result:", result
plt.show()

My hypothesis is that the large value in x is causing the bin
interval size to become infinitesimally small, but is it
conceptually wrong of me to expect a histogram for such large
values to still work? If so, what would be a workaround? I don't
control the data I am trying to plot, and sometimes there's yes,
only a single value, and yes, it's that large...

(All this is done with matplotlib 1.1.0 on Debian stable (v6.0.x)
for Python 2.6.6. uname: Linux foo 2.6.32-5-686 # 1 SMP Mon
Oct 3 04:15:24 UTC 2011 i686 GNU/Linux).