Jupyter Slides - How do I have a function that creates new slides?

I have a function dplots(x) that loops through a nested for loop and creates several plots (using matplotlib) when running. I usually save these plots as png images on my computer and then copy and paste them to a powerpoint but it becomes tedious. How do I add this into jupyter slides and be able to have two images on each slide, stop and create a new slide until all images have posted?

Hi Rithika,
I finally finished all the basics of the idea you outline here. If you go here and press launch binder you spin up a session where it will step through automatically taking directory of images and make a notebook for a RISE slideshow that has two images side-by-side for each cell.

It is set up to make test images right now so you don’t need to even have your own images to test it.

While I need to make it handle different image sizes dynamically and put a little more advice on how to rearrange the images, the backbone is there. Plus, I’d like to eventually add a widget that displays the list of images in the directory and then lets you arrange the order prior to making all the slides.