pythonmatplotlibmplfinance

matplotlib / mplfinance is it possible to add a title to the plot?


I have made a plot with mplfinance: enter image description here

Is it possible to add an title to the mplfinance plot(like plt.title(stock)? Or is it possible a chart like that with matplotlib?

apdict = [mpf.make_addplot(df[['ema34High','ema34Low']],color='y',linestyle='dashdot'),
      mpf.make_addplot(df[['SMA10High','SMA8Low']],color='b',linestyle='dashdot'),
     ]
mpf.plot(df,volume=True,addplot=apdict,style='starsandstripes',datetime_format=' %A, %d- 
%m',xrotation=45)enter code here

Solution

  • You can add title („My Title”) argument to the plot method:

    mpf.plot(df, ..., title="My Title")
    

    but you can also add axtitle („My Title”) argument instead

    mpf.plot(df, ..., axtitle="My Title")
    

    because it also appear above the chart and fits better than standard title.