Large values in histograms not showing

Hi all,

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 y is causing the bin
interval size in x 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 miranda 2.6.32-5-686 #1 SMP Mon
Oct 3 04:15:24 UTC 2011 i686 GNU/Linux).

Any help/advice will be much appreciated.

--
Leo Breebaart <leo@...3879...>

Confirmed. This seems to be a bug, but a quick glance at hist() doesn’t make it obvious to me what the cause is. Perhaps it is in bar()?

Leo, could you please file a bug report on github?

Thanks,
Ben Root

···

On Tue, Dec 6, 2011 at 6:56 AM, Leo Breebaart <leo@…3880…> wrote:

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()