For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
Plots overwriting each other in Jupyter Notebook
-
Hi all,
I'm using Backtrader in a Jupyter notebook. I'm generating a
Cerebro
instance, adding some indicators, and doing a plot in two separate cells. When I run the second cell, it overwrites the plot from the first cell:I'd like the first graph under the first cell and the second graph under the second cell. I've put
plt.figure
in between the two and that hasn't worked. I'm using the%matplotlib notebook
magic; I've also tried%matplotlib inline
andiplot=False
to no avail.Any help? Thanks!
-
Sorry, I trimmed off the crucial bottom of the screenshot. Updated version:
-
This is a shot in the dark, I haven't tried to reproduce. But maybe try in the first cell:
fig1 = cerebro.plot() fig1.show()
and in the second cell:
fig2 = cerebro.plot() fig2.show()
-
I see what you're going for, yeah. Alas:
--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-5-b8fba0c10c1f> in <module> 6 cerebro.run() 7 fig = cerebro.plot() ----> 8 fig.show() AttributeError: 'list' object has no attribute 'show'