Can you alter the example given by the user on this example? I think the fix there uses the matplotlib documentation example.
Edit: thought I should be more specific in my reply and give an example.
import numpy as np
import matplotlib.pyplot as plt
data = np.random.randn(10000) * 0.5 + 3. # making some random data to bin
bin_edges = np.linspace(0, 6, 7) # make the bins
bin_centres = np.linspace(0.5, 6.5, 6) # for plotting only
my_hist = np.histogram(data, bins = bin_edges)[0]
f, (ax, ax2) = plt.subplot(2,1,sharex = True, facecolor = 'w') # make the axes
ax.bar(bin_centres, my_hist) # plot on top axes
ax2.bar(bin_centres, my_hist) # plot on bottom axes
ax.set_ylim([4600,4900]) # numbers here are specific to this example
ax2.set_ylim([0, 500]) # numbers here are specific to this example
ax.spines['bottom'].set_visible(False)
ax2.spines['top'].set_visible(False)
ax.xaxis.tick_bottom()
ax.tick_params(labeltop=False)
ax2.xaxis.tick_bottom()

Not too sure what the last lines did but when I did them they gave me a pretty good approximation of the example I linked to above. If you want to make it look prettier then there is more you can do, see the documentation for matplotlib.pyplot.bar and the example I linked.