I have data displayed in a hitogram with the following code:
angles = data[columns[3]]
num_bins = 23
avg_samples_per_bin = 200
# len(data['steering'])/num_bins
hist, bins = np.histogram(data['steering'], num_bins)
width = 0.7 * (bins[1] - bins[0])
center = (bins[:-1] + bins[1:]) * 0.5
plt.bar(center, hist, align='center', width=width)
plt.plot((np.min(angles), np.max(angles)), (avg_samples_per_bin, avg_samples_per_bin), 'k-')
displaying the following:
I'm looking for a function that will delete all data above the line. or in other words, the data in each bin cannot exceed 200.
Is there a neat way of doing this?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…