From ab0cbe537e5404a60c63cc3402e4198e1e34aca0 Mon Sep 17 00:00:00 2001 From: Kernc Date: Mon, 24 Feb 2020 14:26:02 +0100 Subject: [PATCH] BUG: Fix plot not saved as specified filename if run within notebook Fixes https://github.com/kernc/backtesting.py/issues/45 --- backtesting/_plotting.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/backtesting/_plotting.py b/backtesting/_plotting.py index 1e6a4ce..abbf25f 100644 --- a/backtesting/_plotting.py +++ b/backtesting/_plotting.py @@ -49,14 +49,12 @@ with open(os.path.join(os.path.dirname(__file__), 'autoscale_cb.js'), def _bokeh_reset(filename=None): curstate().reset() - # Test if we are in Jupyter notebook - if IS_JUPYTER_NOTEBOOK: - curstate().output_notebook() - elif filename: + if filename: if not filename.endswith('.html'): filename += '.html' - output_file(filename, title=filename) + elif IS_JUPYTER_NOTEBOOK: + curstate().output_notebook() def colorgen():