'Adjusting date tick labels through Python matplotlib
I would like to visualize xticklabels suitably by decreasing the frequency of each tick similar to here. Therefore, I found this example as a solution to eliminate the main issue (see below). Therefore, the code I got:
from matplotlib import pyplot as plt, dates as mdates
#Blank subplots
fig, axs = plt.subplots(4, 3, sharex='col', sharey='row', figsize = (6,3), dpi = 140)
#Loop through each chart in the subplot
for count, ax in enumerate(axs.reshape(-1)):
ax.plot(dfN[count]["Tarih"], dfN[count]["PM10"])
ax.xaxis.set_major_locator(mdates.MonthLocator(bymonth=(1, 7)))
ax.xaxis.set_minor_locator(mdates.MonthLocator())
ax.xaxis.set_major_formatter(mdates.DateFormatter('%Y-%b'))
for label in ax.get_xticklabels(which='major'):
label.set(rotation=30, horizontalalignment='right')
plt.show()
However, this one throws further issue as below:

The date is not starting with my actual date data. It is starting with 1970.
Any suggestions ? Thanks
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

