我试着用折线图绘制条形图。我创建了2个子批次。 使用以下代码
RSI_14 = df['RSI_14']
df['ATR_14'] = df['ATR_14'].astype(float)
ATR_14 = df['ATR_14']
fig5 = plt.figure(figsize=(14,9), dpi=200)
ax1 = fig5.add_subplot(211)
ax2 = fig5.add_subplot(212)
ax1.plot_date(x=days, y=RSI_14,fmt="r-",label="ROC_7")
ax2 = df[['indx','ATR_14']].plot(kind='bar', title ="V comp",figsize=(7,4),legend=True, fontsize=12)
ticklabels = ['']*len(df.indx)
ax.xaxis.set_major_formatter(ticker.FixedFormatter(ticklabels))
plt.gcf().autofmt_xdate()
pp.savefig()
下面创建的图像与我期望的非常不同。我没试过别的方法,但没想到。 感谢任何帮助。在
这是样本数据
^{pr2}$
x轴将是数据帧的索引,因此需要确保日期以日期对象表示,并且日期列是索引:
结果:
我希望你能从这一点开始管理整个子流程。在
我不确定你是否想把它看作是主次轴,但下面是你如何做到的。在
产生:
相关问题 更多 >
编程相关推荐