I am trying to plot plot hist with dates in x axes and adjust dates. My code is
ax=plt.hist(df[ (df['disease']==1) & (df['FARM_NUM']==1282000)]['DATE'],bins=20)
ax.set_xlim([datetime.date(2020, 3, 15), datetime.date(2021, 7, 1)])
plt.xticks(rotation=90)
plt.show()
and I get an error:
AttributeError: 'tuple' object has no attribute 'set_xlim'
What am I doing wrong? thx
fig, ax = plt.subplots(); ax.hist(....? You may also want to read about the differences between pyplot and OOP.