Learning Scientific Programming with Python (2nd edition)

P6.3.2: Plotting a histogram with pyplot.bar

Question P6.3.2

We have seen how to create a histogram plot from an array with pyplot.hist, but suppose you have already created arrays hist and bins using np.histogram and wish to plot the resulting histogram from these arrays. You can't use pyplot.hist because this function expects to act on the original array of data. Use pyplot.bar (documented here; see also Section 7.1.2 of the book) to plot a hist array as a bar-chart.