最近學pandas和資料視覺化,做的練手程序
#coding:utf-8
import tushare as ts
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.dates as mdate
......
fig1 = plt.figure(figsize=(15,5))
ax1.xaxis.set_major_formatter(mdate.DateFormatter('%H:%M'))#设置时间标签显示格式
plt.xticks(pd.date_range(start='09:00',end='09:10',freq='60S'),rotation=90)
plt.title('percent')
plt.plot(real_data_ave,'.-')
plt.show()
問題是我這樣做,X軸看不到時間是幾點幾分,怎麼解決?