-
-
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
added option to download an image of the most recent plot #494
Conversation
yankev
commented
Jun 2, 2016
•
edited
Loading
edited
- This change is for the offline notebook mode
- This is the first attempt at it, there may be better solutions that I plan to look at
- Need to add docstring
Made the inline download method a part of the Note: This can be applied to other methods later on, could also put the script injection into another function similar to The previous method allowed you to download the plot that was most recently plotted and this wouldn't run when the notebook was rerun. |
This reverts commit b2f9db9.
Demo of the functionality (for Issue #483): Right now have I have two ways of downloading the plot: The first way involves adding a few keyword arguments to existing
(offline.download_notebook_image) @jackparmer @cldougl @chriddyp |
You can also find some notebooks to test the functionality here: Note: This will only wok in Firefox, the fix for Chrome will come when this fix get's released. |
Hey @yankev -
|
We may want to print a message also in Jupyter notebook:
I'm worried we're going to get a lot of complaints that the client-side image export is not sufficiently fully featured, because folks don't realize we have also have a full-blown server just for image export. |
@theengineear Addressing some concerns: I have the condition to check whether the page is loaded before injecting the download script, so on page reloads/re-opening the notebook, the confirm and download prompts shouldn't show up. |
Sweet! Taking a peek right now. |
check_end = '}}' | ||
elif type == 'plot': | ||
check_start = '' | ||
check_end = '' |
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.
🐄
else:
raise SomeException( .. )
?
Great! Let's do it! 💃 after you've considered my comments. |
…of `get_image_download_script`
@theengineear k, should be good. I put in a neat check to find the the name of the caller of |
@@ -48,14 +49,26 @@ def get_plotlyjs(): | |||
plotlyjs = resource_string('plotly', path).decode('utf-8') | |||
return plotlyjs | |||
|
|||
def image_download_script(type): | |||
def get_image_download_script(caller): | |||
''' |
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.
🐄 We typically use """
, not '''
for docstrings.
@yankev sorry to be a party 💩-er, but I think you should stick with the more straight-forward implementation for inferring who called the function. If it makes you feel better, you could use |
… caller of `get_image_download_script`" This reverts commit 0582283.
@theengineear k seems to be in working shape. Let me know if there's anything else. |
Beep, boop, 💃. Nice work! |
@theengineear thanks man! This was a super messy one, so many avoidable errors. Thanks for reviewing it! |