Since matplotlib.finance has been deprecated, how can I use the new mpl_finance module?

Furqan Hashim picture Furqan Hashim · Feb 21, 2017 · Viewed 90.1k times · Source

I am trying to import matplotlib.finance module in python so that I can make a Candlestick OCHL graph. My matplotlib.pyplot version is 2.00. I've tried to import it using the following commands:

import matplotlib.finance
from matplotlib.finance import candlestick_ohlc

I get this error:

warnings.warn(message, mplDeprecation, stacklevel=1) MatplotlibDeprecationWarning: The finance module has been deprecated in mpl 2.0 and will be removed in mpl 2.2. Please use the module mpl_finance instead.

Then instead of using the above lines in python I tried using the following line:

import mpl_finance

I get this error:

ImportError: No module named 'mpl_finance'

What should I do to import candlestick from matplotlib.pyplot?

Answer

duhaime picture duhaime · Mar 14, 2019

In 2020, one can now pip install mplfinance