np.histogram( code example

Example: numpy histogram 0 to 100 percent

kwargs2 = dict(histtype='step')
fig, ax1=plt.subplots(1,1,sharey=True, facecolor='w',figsize=(8,6))

counts_zi, bins_zi = np.histogram(np.array(dt_mu_zi)*60)
ax1.hist(bins_zi[:-1], bins_zi, weights=100*counts_zi/counts_zi.sum(),color='red', **kwargs2)

x0, x1 = ax1.get_xlim()
ax1.set_xlim([x0,x0+1*(x1-x0)])

ax1.set_ylabel('Frequency',fontsize=12)
ax1.set_xlabel('Delta time (minutes)',fontsize=12)
plt.xticks([-180,-150,-120,-90,-60,-30,0,30,60,90,120,150,180])