How to get a matplotlib Axes instance to plot to?

前端 未结 2 1729
滥情空心
滥情空心 2020-12-03 00:09

I need to make a candlestick chart (something like this) using some stock data. For this I want to use the function matplotlib.finance.candlestick(). To this function I need

2条回答
  •  执念已碎
    2020-12-03 01:07

    You can either

    fig, ax = plt.subplots()  #create figure and axes
    candlestick(ax, quotes, ...)
    

    or

    candlestick(plt.gca(), quotes) #get the axis when calling the function
    

    The first gives you more flexibility. The second is much easier if candlestick is the only thing you want to plot

提交回复
热议问题