This call to matplotlib.use() has no effect because the backend has already
been chosen; matplotlib.use() must be called before pylab, matplotlib.pyplot,
or matplotlib.backends is imported for the first time
It would seem you already made a call to matplotlib or imported something. Or you are running inside an environment which does it for you.
Or read this:https://community.backtrader.com/topic/772/better-matplotlib-support-in-jupyter/