I'm trying to create plot with x-axis as hourly data (step = 1 hour). Although I defined an x-data as array with hourly data, I've gotten x-values with 00:00 (see screenshot).
import pandas as pd
import matplotlib.mdates as mdates
range_hour = pd.date_range(start='2021-01-01', periods=24, freq='H')
xdata_hour = range_hour.hour.values
h_fmt = mdates.DateFormatter('%H:%M')
plot(xdata_hour, ydata)
ax.xaxis.set_major_formatter(h_fmt)
So my questions are:
How can I fix this null issue?
How can I get one hour steps? x values should represent a day hours [00:00, ..., 23:00].