-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
V1.10.0 - Inject plotly.js into the output cell on every init_notebook_mode
call
#469
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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)
Full description of changes (from changelog):
|
init_notebook_mode
callinit_notebook_mode
call
cc @yankev @theengineear @mdtusz @BRONSOLO @Kully @aggFTW This fixes #458 in a slightly different way than version 1.9.13 proposed. This change fixes an issue in 1.9.13 introduced where This is the notebook that I am using for QA. Unfortunately, this stuff is still hard to catch in our automated tests. https://gist.github.com/chriddyp/170f46b36a9a3be7caee96eb3d4118bc - @yankev - could you make sure that this works as intended? @mdtusz - can we add a test that ensures that plotly.js isn't injected multiple times? |
if not _ipython_imported: | ||
raise ImportError('`iplot` can only run inside an IPython Notebook.') | ||
|
||
global __PLOTLY_OFFLINE_INITIALIZED | ||
# Inject plotly.js into the output cell |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are missing
if not __PLOTLY_OFFLINE_INITIALIZED:
no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not actually, that's the heart of the fix. Before, we had this check:
if not __PLOTLY_OFFLINE_INITIALIZED:
return
which meant that if you ran this function twice, we return None
the second time which cleared the output cell (which previously had plotly.js
in it). Now, we just inject plotly.js
into the output cell every time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*__*
oh, sweet! sorry, def confused by that on the first read.
💃 for the change after we hear back from @yankev on #469 (comment) |
What we do is we use plotly inside of an Basically, add this to your test notebook code as a use case:
|
@aggFTW so it seems that the |
No, it has never persisted. When plotly was broken, a refresh would show an exception though. We should avoid that behavior. |
@yankev sounds like we're good. can you fix or update the tests and deploy? |
@chriddyp yep got it |
No description provided.