I am plotting histograms and I found this on stack exchange which works great: histogram for discrete values
Here is the code posted there:
import matplotlib.pyplot as plt
import numpy as np
data = range(11)
data = np.array(data)
d = np.diff(np.unique(data)).min()
left_of_first_bin = data.min() - float(d)/2
right_of_last_bin = data.max() + float(d)/2
plt.hist(data, np.arange(left_of_first_bin, right_of_last_bin + d, d))
plt.show()
I am using it with a case where d = 2.84e-5, the output of np.arrange() above is then 68704 in length. If I run this from python interpreter (python 3.5) on ubuntu 14.04 from an anaconda environment, the system hangs and I can not recover without ctrl-c which kills the interpreter. I am wondering if there is a limit on the size of bins in plt.hist() or if there is something inherently wrong with this approach. If a limitation, I would expect an error rather than a hang. The code works fine if d is not too small. The length of my data might be impacting this as well, it was 22289. I guess it could just be churning and I am not waiting long enough?
I searched for matplotlib.pyplot.hist limitations and other variations and could not find anything. The documentation from what I can tell does not mention a limit. Thank you.