我能够运行“mpl_finance”candlestick_ohlc函数,使用以下(仅相关)代码,图形显示如预期:
mondays = WeekdayLocator(MONDAY) # major ticks on the mondays
alldays = DayLocator() # minor ticks on the days
weekFormatter = DateFormatter('%b %d') # e.g., Jan 12
dayFormatter = DateFormatter('%d') # e.g., 12
fig, ax = plt.subplots()
fig.subplots_adjust(bottom=0.2)
ax.xaxis.set_major_locator(mondays)
ax.xaxis.set_minor_locator(alldays)
ax.xaxis.set_major_formatter(weekFormatter)
candlestick_ohlc(ax, zip(mdates.date2num(quotes.index.to_pydatetime()),
quotes['open'], quotes['high'],
quotes['low'], quotes['close']),
width=0.6)
ax.xaxis_date()
ax.autoscale_view()
plt.setp(plt.gca().get_xticklabels(), rotation=45, horizontalalignment='right')
plt.title('PETR4 daily quotes')
plt.show()
现在我想在这张图上加一条y=26.5的水平红线。。。我应该如何进行
(我真正的问题是:我应该如何/在哪里键入类似axvline(…)的内容,以便能够在同一个图表中显示新数据?)
谢谢
当然,大卫。再次感谢你的帮助。希望在其他职位上看到你
感兴趣的读者将能够适应下面的“真实内容”(它正在工作)
(蓝色圆点被添加到使用/提及的模块创建的图形中。)
问候,, fskilnik
相关问题 更多 >
编程相关推荐