import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
fig, ax1 = plt.subplots(2,3,figsize=(50,30)) # 使用subplots()创建窗口 2行3列
ax1[0][0].plot(x_,df['last'], '-', c='green',label='tick_real', linewidth = 1) #同上
plt.legend(loc='best')
ax2= ax1[0][0].twinx() # 创建第二个坐标轴
ax2.plot(x_,df['volume'], label='volume')
b3=plt.bar(x_,df['volume'] )#柱状图
for b in b3:
h=b.get_height()
if abs(h)>1000:
ax2.text(b.get_x()+b.get_width()/2,h,'%d'%int(h),ha='center',va='bottom')
ax1[0][0].set_xticklabels(x__)#设置横坐标内容
plt.gca().xaxis.set_major_locator(ticker.MultipleLocator(11))#设置x轴间隔
fig.autofmt_xdate() # 自动旋转xlabel