nteract / scrapbook

A library for recording and reading data in notebooks.
https://nteract-scrapbook.readthedocs.io
BSD 3-Clause "New" or "Revised" License
281 stars 26 forks source link

Is it possible to use scrapbook to get just the notebook visualizations/output and save it into a PDF? #50

Closed victorluizgomes closed 4 years ago

victorluizgomes commented 5 years ago

I am trying to create PDF reports from Jupyter notebook outputs (graphs, tables, visualizations, ...) using scrapbook.

I been trying to get the scraps, and somehow convert that data into a PDF report, is scrapbook the best way? How could that be done.

If not do you suggest me taking a look at any other nteract tool?

Thank you.

MSeal commented 5 years ago

For context and resolutions from nteract slack thread:

Victor Gomes [11:36 AM] Hey guys, I am wondering if I can somehow use scrapbook or nteract on a Jupyter notebook to get just the outputs of cells without input. With the objective of saving those to a PDF afterwards? Any help or insight on how this is possible (or if it is) would be much appreciated!

jarmokivekas [1:22 PM] @Victor Gomes For something small you can use Toggle input visibility from each cell toolbar to hide the input in Nteract, and then use File > Export PDF. I often do that to hide code and only show the resulting figures.

Victor Gomes [1:27 PM] @jarmokivekas that is using the nteract application right? What if I have to use Jupyter notebook and I need to do that programmatically to scale :grimacing:

jarmokivekas [1:50 PM] Right, in the Nteract desktop application. You could set the input visibility to be hidden in nteract by programatically editing the json in the ipynb file directrly, but that's probably not the best way...

mseal [1:54 PM] Scrapbook only saves individual visualizations and data points, not the entire notebook output so it's likely not a good fit for this.

Loading the json with nbformat and editing the metadata before passing to nbconvert to generate a PDF (which is what the Jupyter server uses to do this) isn't unreasonable of a code path. It would require a little wrapper code to do the programatic conversion but nothing crazy.

Victor Gomes [2:40 PM] Thank you for your answer @mseal that is good. I talked with my team, it is fine that only individual visualizations can be saved. I do need though to be able to save a scraps_report() or all my scraps in a notebook somehow to be able to serialize and share with someone else (doesn't need to be necessarily in PDF format) where they would be able to just open up these scraps and see them. Any suggestions for that?

mseal [4:55 PM] @Victor Gomes https://github.com/nteract/scrapbook#scraps_report-displays-a-report-about-collected-scraps might satisfy your need. Or you'll need to convert the HTML displays into whatever format you want manually nteract/scrapbook A library for recording and reading data in notebooks. Website https://nteract-scrapbook.readthedocs.io Stars 88 nteract/scrapbookOct 21st, 2018Added by GitHub