Skip to content
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

Reloaded notebook's PlotlyJS doesn't work #45

Closed
cstjean opened this issue Jun 11, 2016 · 5 comments
Closed

Reloaded notebook's PlotlyJS doesn't work #45

cstjean opened this issue Jun 11, 2016 · 5 comments

Comments

@cstjean
Copy link
Contributor

cstjean commented Jun 11, 2016

Once every five notebooks or so (OSX, Julia 0.4.5, using Plots.jl), the notebook gets in a broken state, such that when I reload it, all PlotlyJS plots have disappeared, and won't come back even after restarting the notebook. The only cure is to 1. Clear all outputs, 2. Save the notebook, 3. Refresh the page. I used to have almost exactly the same problem with Bokeh in python (except that Bokeh was at least printing a red Javascript error adding output! message), but it didn't happen as often. My guess is that this isn't Julia specific, but I wanted to get some feedback before posting upstream. Is this a known issue?

@sglyon
Copy link
Member

sglyon commented Jun 11, 2016

Hey @cstjean thanks for posting. This is a known issue.

I believe the problem is that when you call using PlotlyJS in the notebook, it adds the Plotly Javascript library as an invisible output of that cell. If that cell gets run a second time then the output is removed, but you as a user have know way of seeing that. Once the output is gone, so is the plotly Javascript and you can no longer create or view figures.

I belive that one way around this would be to expose a function that can be called at any time to force the Plotly Javascript to be reloaded. I haven't tried this approach yet, but am hopeful that it would work

@cstjean
Copy link
Contributor Author

cstjean commented Jun 11, 2016

That's an interesting problem. FWIW, Bokeh notebooks force you to write Bokeh.output_notebook() at the top. I assume that's because they haven't found any better solution to the problem in Python. Plots.jl already asks users to write plotlyjs(). It might be a good place to output the Plotly javascript.

@malmaud
Copy link
Collaborator

malmaud commented Jun 11, 2016

The official Plotly Python package makes you do that to, so it seems eminently reasonable for us to follow suit.

@sglyon
Copy link
Member

sglyon commented Jun 11, 2016

That's too bad. I really liked the magic of using PlotlyJS setting up the right frontend depending on context. I guess it isn't a totally feasible solution.

I'll try to patch that up soon, but if any one beats me to it -- all the better!

@sglyon
Copy link
Member

sglyon commented Jun 17, 2016

Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants