For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/

cerebro.plot() not work with VScode



  • (Uploading 100%) (image url))

    ReferenceError: IPython is not defined
    at eval (eval at runCodeHere (vscode-resource://file///c%3A/Users/baihe/.vscode/extensions/ms-python.python-2020.4.74986/out/datascience-ui/notebook/vendors~nteract_transforms.bundle.js:2:11583), <anonymous>:764:1)
    at runCodeHere (vscode-resource://file///c%3A/Users/baihe/.vscode/extensions/ms-python.python-2020.4.74986/out/datascience-ui/notebook/vendors~nteract_transforms.bundle.js:2:11583)
    at t.value (vscode-resource://file///c%3A/Users/baihe/.vscode/extensions/ms-python.python-2020.4.74986/out/datascience-ui/notebook/vendors~nteract_transforms.bundle.js:2:12015)
    at Io (vscode-resource://file///c%3A/Users/baihe/.vscode/extensions/ms-python.python-2020.4.74986/out/datascience-ui/notebook/commons.initial.bundle.js:2:2192129)
    at Fo (vscode-resource://file///c%3A/Users/baihe/.vscode/extensions/ms-python.python-2020.4.74986/out/datascience-ui/notebook/commons.initial.bundle.js:2:2195051)
    at vscode-resource://file///c%3A/Users/baihe/.vscode/extensions/ms-python.python-2020.4.74986/out/datascience-ui/notebook/commons.initial.bundle.js:2:2208131
    at Object.t.unstable_runWithPriority (vscode-resource://file///c%3A/Users/baihe/.vscode/extensions/ms-python.python-2020.4.74986/out/datascience-ui/notebook/commons.initial.bundle.js:2:25151)
    at Ms (vscode-resource://file///c%3A/Users/baihe/.vscode/extensions/ms-python.python-2020.4.74986/out/datascience-ui/notebook/commons.initial.bundle.js:2:2208065)
    at Es (vscode-resource://file///c%3A/Users/baihe/.vscode/extensions/ms-python.python-2020.4.74986/out/datascience-ui/notebook/commons.initial.bundle.js:2:2207841)
    at ws (vscode-resource://file///c%3A/Users/baihe/.vscode/extensions/ms-python.python-2020.4.74986/out/datascience-ui/notebook/commons.initial.bundle.js:2:2207186)



  • TIM截图20200427160052.png



  • do u solve this problem or not? I come across the same problem. When I use the backtrader in vscode, cerebro.plot() seems not work



  • After some search, it seems the problem with ipython kernel. So just use another plot frame is ok to show the figure.

    matplotlib.use('Qt5Agg')
    plt.switch_backend('Qt5Agg')
    
    cerebro.plot(height = 30, iplot = False)
    plt.show()
    

Log in to reply
 

});