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

plotly.offline.iplot - Option to save to a file and embed link in notebook #1469

Closed
Nikolai-Hlubek opened this issue Mar 19, 2019 · 3 comments

Comments

@Nikolai-Hlubek
Copy link

Nikolai-Hlubek commented Mar 19, 2019

Dear all

The following use case:
I use jupyter with plotly. In some notebooks we plot large amount of data > 1e6 points. Embedding the plot directly in the notebook causes the notebooks to get very large > 100Mb.
This causes issues with

The following solution seems to solve these issues for me:

filename = 'results/foo.html'
plotly.offline.plot(fig, filename=filename)
IPython.display.display(IPython.display.IFrame(src=filename, width=1200, height=800))

This saves the picture to an external file and embeds the contents of this file in Jupyter, therefore bypassing all issues mentioned above. Since googling showed that other users sometimes have similar issues maybe it is a good idea to add the above code to plotly.offline.iplot and make it available via a option?

Best regards
Nikolai

@jonmmease
Copy link
Contributor

Thanks for the suggestion @Nikolai-Hlubek, I can see that this could be really useful in some situations. As it happens, I was in the middle of large rewrite of the plotly.py rendering system when I saw this, and it was actually pretty easily to integrate it as an option based on what I had so far. See the writeup at #1474 for more context if you're interested!

@onclick360-blog
Copy link

I am using Jupyter notebook as a public server and accessing remotely when i am trying to run some plot with plotly it's not showing on my remote web browser its throw error "127.0.0.1 refused to connect." not sure in iframe how to use original server ip instead of 127.0.0.1.

@Nikolai-Hlubek
Copy link
Author

Dear Jon

I forgot to respond to your reply. Thank you that this functionality has been implemented.

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