Is there a way to save the output of a cell?

It sounds somewhat like you want to clone the notebook and rerun with different parameters, or perhaps have two cells you wish to compare? The scrapbook project lets you save the results (plot or primitive data) and recall it programmatically, so if you were versioning your notebooks with different saves you could do:

sb.glue("my-plot", plot_obj, display=True)

in the notebook, then in a downstream notebook:

nb = sb.read_notebook('prior_notebook.ipynb')
nb.scraps["my-plot"]

Or if you wanted to re-render the scrap to compare visually:

nb = sb.read_notebook('prior_notebook.ipynb')
nb.reglue("my-plot")

The project hasn’t had recent updates, but that was somewhat intentional as I was working on other jupyter repos. I’m going to be actively contributing some more features now that some of my other open source tasks are done.

2 Likes