To gain access to mplfinance's Figure and Axes objects, there are two ways:
Method 1. Set returnfig=True
when calling plot:
fig, axlist = mpf.plot(data,...,returnfig=True,...)
axlist
will be a list of axes corresponding to the panels from top to bottom, two axes per panel where the first is the primary axes and the next is the _secondary axes. For example, if you have 3 panels then returnfig=True
will return 6 Axes objects. axlist[0]
and axlist[1]
will be the primary and secondary axes, respectively, for panel 0. axlist[2]
and axlist[3]
will be the primary and secondary axes, respectively, for panel 1, etc.
Method 2. Create your own Figure and Axes objects and pass these into mplfinance. You can see examples of how to do this here.
Please note also that, when specifying x,y coordinates for positioning of text, legends, etc. then:
if show_nontrading
kwarg is False
(i.e. the default value if unspecified) then the x-axis values are not actually dates as they appear, but are integer values from zero up to the number of rows in your dataframe.
HTH