i'm trying to create simple hist plot, using plt.hist. I encountered a strange problem, as you can see in the figure - the bins just overlap each other.
Here is my code:
intervals = np.arange(0.5,max(data)+0.5, .5)
data = np.array(data)
# build labels list
labels = [ str(intervals[i])+'-'+str(intervals[i+1]) for i in range(len(intervals)-1) ]
labels.append(str(max(intervals))+'-'+str(max(intervals)+.5))
# plot
fig, ax = plt.subplots(figsize=(12, 9))
plt.hist(x=data, bins=intervals, width=1)
ax.set_xticks(range(len(intervals)))
ax.set_xticklabels(labels=labels, rotation=45, fontsize=12)
ax.set_title("Max wind speed ~24hr before dust emission ("+loc+")", fontsize=18)
ax.set_xlabel('Wind Speed [m/s]', fontsize=14)
ax.set_ylabel('No. of Events', fontsize=14)
plt.grid(True)
plt.tight_layout()
plt.savefig('th_hist'+loc+'.png')
plt.show()
`
I tried to change the axis size, and also played with the width value.