-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
FIgureWidget not working with nbviewer #1116
Comments
@Tarzz On my machine it works with both Python 2.7.13 and Plotly 3.1.0, respectively Python 3.6.4 and Plotly 3.1.1. Have you installed ipywidgets? |
@empet It works on my machine, but not on the external/HTML viewers (like nbviewer.jupyter.org). |
No, the plot is not displayed in nbviewer. As I understood you are working on this feature :) |
@Tarzz Well, to be more precise I hope that the FigureWidget instances will be displayed in the notebooks uploaded to Plotly cloud, not those rendered by nbviewer. |
@Tarzz In a comment to this issue jupyter-widgets/ipywidgets#2063 is suggested how to get the widgets displayed in nbviewer. |
The behavior I'm seeing is that the figure axes are being displayed, but not the data. Is that what you're both seeing? I think this is an issue related to the way that numpy arrays are encoded as binary buffers. These buffers are stored as JavaScript TypedArrays in the JavaScript widget model. And when the buffers are saved (through the "Save notebook widget state" process), and then restored (when a page is viewed on nbviewer) they are not being restored as typed arrays, but as To test the theory, here's a notebook with a figure that doesn't use numpy arrays. I saved widget state and pushed to GitHub and then loaded with nbviewer. I'm not quite sure what to do about it yet... |
Hi @maartenbreddels, I was wondering if you would be willing to share some of your sage widget wisdom with us here. For the plotly.py |
Hi @Tarzz and @jonmmease, I converted the |
@empet :
Selections will not work on nbviewer (or Plotly Cloud) because they need to interact with Jupyter Kernel to work, whereas nbviewer only offers static/HTML views. It will not be interactive, but you should be able to render the "saved" state though. |
See plotly/plotly.js#2911 for a proposed solution |
Make sure you have a custom serializer, take a look at for instance ipyvolume's ScatterModel. In the end the typed array will be converted to sth like |
Thanks @maartenbreddels ! That's what I was missing. @tarzzz , it looks like I should be able to fix this in the widget library without needing a change to Plotly.js after all (I'm still going to work on that Plotly.js change for other reasons, but I don't think it's critical for getting this working now). |
Done in #1117 |
Example Notebook: http://nbviewer.jupyter.org/gist/tarzzz/7aa6eb0673d5b11b55748c1dd9f74537#
The Plot is not displayed when the chart is viewed on nbviewer (or as the HTML version).
Not sure if this is a bug, or if it is not intended to work in static views.
cc: @jonmmease
The text was updated successfully, but these errors were encountered: