import pandas as pd
import matplotlib.pyplot as plt
date_time = ['08:30', '09:30', '10:30', '11:30', '12:30', '13:30', '14:30']
date_time = pd.to_datetime(date_time)
temp = [2, 4, 6, 4, 6,9,8]
DF = pd.DataFrame()
DF['temp'] = temp
DF = DF.set_index(date_time)
fig, ax = plt.subplots()
fig.subplots_adjust(bottom=0.3)
plt.xticks(rotation=90)
plt.plot(DF)
但是输出是x轴,就像这个:
plot x-axis as date in matplotlib
我对X轴的期望值如下:
'08:30' '09:30' '10:30' '11:30''12:30' '13:30' '14:30'
或
'08:30' '08:40' '08:50' '08:60' .... '15:00'
那么我如何将日期转换成我需要的分钟数据,以及如何将线转换为曲线
有朋友能帮上忙吗?