- Panels Method
- External Axes Method
- The Panels Method is easy to use and requires little or no knowledge of matplotlib, and no need to import matplotlib.
- The Panels Method handles 95% of the most common types of financial plots and market studies.
- The Panels Method attains its simplicity, in part, by having certain limitations.
These limitiations are:- Subplots are always stacked vertically.
- All subplots share the same x-axis.
- There is a maximum of 32 subplots.
- The Panels Method is adequate to plot:
- ohlc, candlesticks, etc.
- with volume, and
- with one or more studies/indicators, such as:
- MACD, DMI, RSI, Bollinger, Accumulation/Distribution Oscillator, Commodity Channel Index, Etc.
- See here for a tutorial and details on implementing the mplfinance Panels Method for subplots.
- The External Axes method of subplots allows the user to create and manage their own Figure and Axes (SubPlots), and pass Axes into
mplfinance
. - Details on how to use this feature are described below.
(code examples can be found in the External Axes notebook). - When passing
Axes
intomplfinance
, somemplfinance
features may be not available, or may behave differently. For example,- The user is responsible to configure the size and geometry of the Figure, and size and location of the Axes objects within the Figure.
- The user is responsible to display the Figure by calling
mplfinance.show()
(orpyplot.show()
).
- Passing external Axes into
mplfinance
results in more complex code but it also provides all the power and flexibility ofmatplotlib
for those who know how to and what to use it. This includes:- plotting on as many subplots as desired, in any geometry desired.
- plotting multiple ohlc/candlestick plots on the same Figure or Axes.
- plotting multiple candlestick plots side-by-side, or in any other geometry desired.
- anitmating or updating plots in real time.
- event handling
- Use method
mpf.figure()
to create Figures.
This method behaves exactly likepyplot.figure()
except thatmpf.figure()
also accepts kwargstyle=
to set the mplfinance style. - Call the usual methods for creating Subplot Axes on the figure:
- When calling the above subplot creation methods, if
fig
was creating usingmpf.figure()
then the Subplot Axes will inheret the mpfinance style information from the figure. Alternatively the user may pass in kwargstyle=
to set different style information for an Axes than for the Figure or other Axes. - Please note the following:
- Use kwarg
ax=
to pass any matplotlib Axes that you want intompf.plot()
- If you also want to plot volume, then you must pass in an Axes instance for the volume,
so instead ofvolume=True
, usevolume=<myVolumeAxesInstance>
. - If you specify
ax=
formpf.plot()
then you must also specifyax=
for all calls tomake_addplot()
- Use kwarg