From 0f3a0482a2c327ae4783ea00a30b4df5caf5559f Mon Sep 17 00:00:00 2001 From: chriddyp Date: Thu, 19 May 2016 13:40:58 -0400 Subject: [PATCH 1/2] Inject plotly.js into the output cell on every `init_notebook_mode` call MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #458 Running init_notebook_mode injects plotly.js into the output cell. Before, if you ran it twice, it would clear the output cell on the second call and remove plotly.js from DOM. This was deceiving, because any existing plots on the page wouldn’t disappear even though their underlying plotly.js was no longer present. But, if you refresh the page, the plots would not render (as plotly.js was no longer in the output cell) --- plotly/offline/offline.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/plotly/offline/offline.py b/plotly/offline/offline.py index bd50e2115ba..f9ac02d69ac 100644 --- a/plotly/offline/offline.py +++ b/plotly/offline/offline.py @@ -60,15 +60,15 @@ def init_notebook_mode(): from IPython.display import HTML, display global __PLOTLY_OFFLINE_INITIALIZED - if not __PLOTLY_OFFLINE_INITIALIZED: - display(HTML("")) + # Inject plotly.js into the output cell + display(HTML("")) __PLOTLY_OFFLINE_INITIALIZED = True From 16dcd24f466ebe083f2a2ee953ba946cfc82ea61 Mon Sep 17 00:00:00 2001 From: chriddyp Date: Thu, 19 May 2016 14:13:00 -0400 Subject: [PATCH 2/2] Changelog entry --- CHANGELOG.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1388cca8197..7eaa68f6c5a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,26 @@ This project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] +## [1.10.0] - 2016-05-19 +### Fixed +Version 1.9.13 fixed an issue in offline mode where if you ran `init_notebook_mode` +more than once the function would skip importing (because it saw that it had +already imported the library) but then accidentally clear plotly.js from the DOM. +This meant that if you ran `init_notebook_mode` more than once, your graphs would +not appear when you refreshed the page. +Version 1.9.13 solved this issue by injecting plotly.js with every iplot call. +While this works, it also injects the library excessively, causing notebooks +to have multiple versions of plotly.js inline in the DOM, potentially making +notebooks with many `iplot` calls very large. +Version 1.10.0 brings back the requirement to call `init_notebook_mode` before +making an `iplot` call. It makes `init_notebook_mode` idempotent: you can call +it multiple times without worrying about losing your plots on refresh. + + +## [1.9.13] - 2016-05-19 +### Fixed +- Fixed issue in offline mode related to the inability to reload plotly.js on page refresh and extra init_notebook_mode calls. + ## [1.9.12] - 2016-05-16 ### Added SSL support for streaming.