to test whether it’s your code in general, I suggest to try it out on a subset/slice of your big tc_array. If you find your code is fine and big data is indeed the problem, you could compute histograms separately for individual subsets and sum them up afterwards (that is, catching and keeping the output of plt.hist; see plt.hist doc). Particularly when doing so, I’d also rather setup the histogram bins beforehand and not let plt.hist determine that by itself.