totalSeed = df.index.tolist()
fig1, ax = plt.subplots()
ax.plot(totalSeed, df.loc[:,'MACDhist_1'])
ax.plot(df.loc[:,'MACDhist_2'])
ax.plot(df.loc[:,'MACDhist_5'])
ax.plot(df.loc[:,'MACDhist_20'])
plt.legend(loc='SouthEast')
xticks=list(range(0,len(totalSeed),40))
xlabels=[totalSeed[x] for x in xticks]
xticks.append(len(totalSeed))
xlabels.append(totalSeed[-1])
ax.set_xticks(xticks)
ax.set_xticklabels(xlabels, rotation=40)
# ax.xaxis.set_major_locator(ticker.MultipleLocator(40))
plt.title("MACDhist")

mark一下看到的其他做法:
本文通过实例演示了如何使用Python的matplotlib库绘制MACDhist指标图表,并展示了不同时间段的MACD变化趋势。此外,还提供了调整坐标轴刻度及标签旋转的方法。
144

被折叠的 条评论
为什么被折叠?



