-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Add Save Tool to NbAgg Figure [backport to 1.4.x] #3974
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
cc @pelson |
CC @mdboom based on the comment in #3972. @blink1073 - the hardest part of this is figuring out where to go to download content. If this is really a route we want to take (I personally don't see much of a use for a save button inside the notebook UI), then perhaps downloadify may be of interest. |
@pelson, my use case is when the figure is part of a larger notebook UI. We could have a "Save" button in the UI, but this is more elegant and in keeping with the rest of the backends' toolbars. |
New method: use the HTML5 |
We can then push the |
Cool. At least speaking for myself, we're always looking for more web/HTML5 development expertise, so feel free to fix up anything else you find that could be done better. |
@mdboom, I'm a beginner at JS, but thanks for the vote of confidence! |
How do we deal with converting the figure to a png when the figure gets killed? Presumably we could just use that method to serve up a png? [disclaimer, making this up as I go] |
Shucks, the |
Success! |
When you click the download button, it opens a new window with the image in the desired type, and you can save it from there. |
@tacaswell, I don't follow your question. |
Hmm, the only two formats that work are PNG and JPG, and the JPG doesn't look that great (it only shows a white background and the plot line itself). Should we just output PNG and remove the selector? |
This needs a re-base. |
Done. |
Is there some reason the drop-down didn't get ported over to the nbagg ui? It seems useful to be able save vector graphics from the notebook. On the other hand, users have access to |
and everything here works as advertised for me. |
At first I tried using toDataURL, but for all but JPEG it ended up falling back on PNG. With JPEG, it rendered the transparent background as black, obscuring the spines. |
@tacaswell - do you have some git foo which allows you to cherry-pick a branch onto v1.4.x? |
Git co v1.4.x Take a look that it added just one commit past upstream v1.4.x with all of That should probably be documented some place On Mon, Jan 12, 2015, 08:13 Phil Elson notifications@github.com wrote:
|
back-ported as 408fed6 |
Seems to have been merged into v1.4.x with 408fed6. (doh - too early in the morning - I should have refreshed my browser) |
Yes On Tue, Jan 13, 2015, 05:08 Phil Elson notifications@github.com wrote:
|
Adds a toolbar save icon that opens a new window with the image that can be saved to a local file.
Also adds ability to save the figure using the "S" key.