1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| import matplotlib.pyplot as plt import matplotlib.ticker as ticker import matplotlib.dates as dates
plt.figure(figsize=(12, 8)) plt.plot(df['Time'], df['Temp']) plt.xlabel('Time') plt.ylabel('Temp (C)')
ax = plt.gca() ax.xaxis.set_major_locator(dates.DayLocator(interval=1)) ax.xaxis.set_major_formatter(dates.DateFormatter('00\n%Y-%m-%d')) ax.xaxis.set_minor_locator(dates.HourLocator(interval=1)) ax.xaxis.set_minor_formatter(dates.DateFormatter('%H'))
ax.yaxis.set_major_locator(ticker.MultipleLocator(10))
plt.show()
|