0

This is driving me crazy and I'm wondering if I just don't understand something fundamental about histograms, matplotlib, or the world. If i try a plot the following data with matplotlib's histogram, i get the following image, which is definitely not correct:

import matplotlib.pyplot as plt

v = [1.25, 5.0, 2.0, 1.0, 3.25, 1.75, 0.25, 2.75, 1.25]
fig, ax = subplots()
ax.hist(v, 8, edgecolor='white')
fig.show()

enter image description here

1.25 seems to be correct, but for example, 5 is entirely wrong, and 1 is not plotted. Am I doing something wrong? (note: the default alignment for a matplotlib histogram is centered over the value)

ItsAnApe
  • 412
  • 1
  • 3
  • 12

1 Answers1

0

I'm an idiot. Its a totally inappropriately small number of bins for the range of values. That's why. I'll leave my post up for other people who might be also make the same mistake and immediately blame matplotlib instead of themselves.

ItsAnApe
  • 412
  • 1
  • 3
  • 12