Skip to content

Images not saved in *.ipynb #16

Closed

Description

@jklymak

Maybe its a design decision, but if I use %matplotlib ipympl in a notebook, there is no image of plots I've made is saved in the *.ipynb file as there was for nbagg. Thats a huge usability issue for me.

I think the cool thing about notebooks is being able to see the output of your work without having to re-run all the code, some of which may no longer work (data moved etc), so this is a pretty big reversion in functionality for me. It also kills the ability to quickly post onto GitHub or gist, and even save as html no longer has a plot. If this is to replace nbagg I hope the image saving gets added back in.

Of course, maybe I'm just doing something incorrectly. This was with master on matplotlib and master on ipympl. Jupyter-notebook = 5.0.0

Activity

  1. SylvainCorlay commented on Aug 14, 2017

    @SylvainCorlay
    Member

    As of ipywidgets 7.0, widgets become regular output, and the live version will just be an item in the mime bundle.

    With the matplotlib widget, we can certainly add an image in the mime bundle for the figure.

    At jupytercon next week, we plan on doing some iterations on ipympl.

  2. modified the milestone: 0.1 on Aug 26, 2017
  3. modified the milestones: 0.1, 0.2 on Nov 20, 2017
  4. fperez commented on Dec 11, 2017

    @fperez
    Member

    Just to add I think this is a key usability feature to match the "old" nbagg/notebook backend. Being able to reload an old notebook or see it on a plain html render with a static png is really important. In nbagg, the seamlessness of how it saved the last static render on figure/notebook close was wonderful.

  5. gregerspoulsen commented on Dec 18, 2017

    @gregerspoulsen

    @fperez : I agree - notebook is an excellent way to document your work, but to use it as such it must be possible to quickly load the notebook and figures without re-running a possibly time consuming analysis.

  6. tylerlekang commented on Dec 20, 2017

    @tylerlekang

    Hi, I recently made the conversion from %matplotlib notebook to import ipympl, and have it working well ... but am sad to find out there is currently no way to “embed” a static version of whatever figures are in the notebook, for quick and easy viewing on GitHub.

    A button with a caption like “embed current figure view as inline PNG” or something to that effect I think is plenty descriptive for users.

    Thank you!

  7. tylerlekang commented on Jan 16, 2018

    @tylerlekang

    Hi, just wondering if this has any chance to be updated soonish? It is a pain point not to be able to quickly view the resulting plots from a notebook's full run (which takes several hours...) on GitHub.

    Is there any workaround? Even taking a screenshot, saving as .png, and being able to use some code to embed that? The plotting "widget" works great ... just have lost this really key feature ...

  8. blink1073 commented on Jan 17, 2018

    @blink1073
    Member

    Hi @tylerlekang, I plan to implement this feature next week at the Jupyter Widget author workshop.

  9. tylerlekang commented on Jan 26, 2018

    @tylerlekang

    Hi @blink1073 ,
    Sorry to be a pest, but I do see new versions of matplotlib uploaded to pypi on Jan 21 and ipywidgets & widgetsnbextension uploaded onJan 24 ... but no new version of ipympl since Nov.

    I did upgrade to the new versions of previously mentioned, but still no embedding of static image of plot figures saved in the notebook.

    Would definitely appreciate it! Thank you sir! :)

  10. blink1073 commented on Jan 28, 2018

    @blink1073
    Member

    @tylerlekang, I got caught up working on JupyterLab itself during the workshop and did not get a chance to work on this.

  11. tylerlekang commented on Jan 29, 2018

    @tylerlekang

    Thank you for the update. Any workaround until the new feature available?

  12. jklymak commented on Jan 29, 2018

    @jklymak
    MemberAuthor

    Doesn't %matplotlib notebook work, or do you need something specific from the new backend?

  13. tylerlekang commented on Jan 29, 2018

    @tylerlekang

    I used %matplotlib notebook with Python 2.7 forever, and it worked great. But then I decided to upgrade everything to Python 3.6, which is what I'm sticking with going forward. After that upgrade, %matplotlib notebook stopped working so well (it was glitchy). I found a GitHub issues thread (think it was for Notebook) that sounded a lot like my issue, and in there they were saying that they wanted to start pushing users to ipympl. So I made that switch, and it works great .... just can't embed a static .png of the figure view into the notebook anymore for quick recall/viewing on GitHub (or when you first load a notebook).

  14. 28 remaining items

  15. jasongrout commented on Feb 27, 2020

    @jasongrout
    Contributor

    But I guess using a checkbox like proposed in jupyter-widgets/ipywidgets#1632 would be the right way to go?

    Yes, as that discussion elaborates, having a checkbox is a much cleaner UX than the current classic notebook widgets menu. That's why we architected JupyterLab to enable such a checkbox.

  16. martinRenou commented on Feb 27, 2020

    @martinRenou
    Member

    Would you be fine if I try opening a PR in the widgetsnbextension (I guess this would be the right place?) changing the "Save widgets state" button into a checkbox?

  17. jasongrout commented on Feb 27, 2020

    @jasongrout
    Contributor

    think an entire dataset for ipyvolume, for example

    Another usecase I can see coming up a lot is the new file upload widget - people upload a file, then save their notebook, and wonder why the entire contents of the file is saved in base64 with the notebook. That could introduce security issues as well - I bet most people wouldn't realize that saving widget state includes the entire contents of that uploaded file.

  18. jasongrout commented on Feb 27, 2020

    @jasongrout
    Contributor

    Would you be fine if I try opening a PR in the widgetsnbextension (I guess this would be the right place?) changing the "Save widgets state" button into a checkbox?

    Sure! I delved into a bit a long time ago (I think I mentioned this on the other thread), and came away with the conclusion that it was a deeper dive into the classic notebook javascript to enable a save hook than I wanted to do at the time.

  19. jasongrout commented on Feb 27, 2020

    @jasongrout
    Contributor

    See jupyter-widgets/ipywidgets#2012 for my previous attempt.

  20. martinRenou commented on Feb 27, 2020

    @martinRenou
    Member

    Thanks! I will look into it.

    That could introduce security issues as well - I bet most people wouldn't realize that saving widget state includes the entire contents of that uploaded file.

    So maybe the checkbox should not be checked by default... I guess this is the choice you've made in JupyterLab?
    And maybe we should put a warning in the ipywidgets documentation concerning the FileUpload widget, saying that it might save the file content on the server.

  21. jasongrout commented on Feb 27, 2020

    @jasongrout
    Contributor

    So maybe the checkbox should not be checked by default... I guess this is the choice you've made in JupyterLab?

    Yes, that is the choice in JupyterLab - no saving by default.

    And maybe we should put a warning in the ipywidgets documentation concerning the FileUpload widget, saying that it might save the file content on the server.

    Great idea - it might save uploaded file content in the notebook if widget state is saved.

  22. martinRenou commented on Feb 27, 2020

    @martinRenou
    Member

    What would be the the way to save this checkbox state from one Notebook session to the other? Is there a kind-of cookie saved by the widgetsnbextension where I can save its state?

  23. BrenBarn commented on Apr 4, 2020

    @BrenBarn

    What is the status of this? It appears to be a major regression from %matplotlib notebook. If plots aren't saved in the notebook, it can't be effectively shared, making it nearly useless. Shouldn't this be a top priority?

  24. pyfrid commented on May 11, 2020

    @pyfrid

    I think stop button #176 is already enough as a first step. It would be nice to have it as soon as possible. It is easier to press stop buttons in all figures in a notebook and convert it to html rather than making a screenshot for every plot manually.

  25. georgeholt1 commented on Sep 8, 2020

    @georgeholt1

    Is there any update to this issue? This majorly undermines the usability of Lab in many cases.

  26. martinRenou commented on Jan 16, 2021

    @martinRenou
    Member

    Trying another approach in #294, as discussed in #150

  27. nvaytet commented on Aug 16, 2021

    @nvaytet

    Just following up to ask if there is an update on this.
    Being able to view figures in a notebook that was saved, without re-running the notebook is being requested by many users of our library.
    Thanks!

  28. martinRenou commented on Sep 21, 2021

    @martinRenou
    Member

    This is fixed in #343

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions