I need to add to the plot some text and I tried to use your guide "How to use your own matplotlib Figure and Axes in mplfinance". But i have an error:
"ValueError: make_addplot() ax
kwargs must all be of type matplotlib.axis.Axes
"
My code:
import mplfinance as fplt
import pandas as pd
df5M = pd.read_csv("D:\\_users_files\\Kirill\\WORK\\fx2youcom\\df5M.csv", index_col=0, parse_dates=True)
fig = fplt.figure(style='yahoo', figsize=(10.8, 6.4))
ax1 = fig.add_subplot(2, 2, 1)
sma = [fplt.make_addplot(df5M['SMA20'].tail(100), color='#f1afe1'),
fplt.make_addplot(df5M['SMA50'].tail(100), color='#ffaf6c'),
fplt.make_addplot(df5M['SMA200'].tail(100), color='#f0dea7')]
fplt.plot(df5M.tail(100),
type='candle',
ax=ax1,
style='yahoo',
title="long_name",
ylabel='5 Minutes',
addplot=sma
)
fig
Whenever you pass an external Axes object into mplfinance.plot()
using the ax=
kwarg, then
volume=True
do volume=axes
where axes
is an Axes object on which you want to plot the volume.ax=
for all calls to mplfinance.make_addplot()
This information was noted at the bottom of the subplots page.
Probably should also be included in the external axes notebook.