How to generate subslides in a loop?

I am generating many plots in a loop, and I would like each one of them to be in a separate subslide.

I have done it by editing the ipynb JSON in a rather rudimentary way using sed, like this:

  for (( i=1; i <= $#; i++ )){
    sed 's/🔻🔻🔻/"]}],"source":[]},{"cell_type":"code","execution_count":1337,"metadata":{"slideshow":{"slide_type":"subslide"}},"outputs":[{"name":"stdout","output_type":"stream","text":["/g' $name.ipynb > $name.tmp
    pipenv run jupyter nbconvert --to slides $name.tmp
    sed -i 's#</body>#<script>$(".jp-Cell-inputWrapper, .jp-OutputPrompt").hide(100,function(){$("div.cell").css({padding:0,border:0});});$("div.output_stderr").hide()</script></body>#g' $name.slides.html

In the notebook I just print("🔻"*3) in the loop.

I am certain there has to be a better way, this was just the first way I found. It works, but it is terrible in a few too many levels. So I decided I would just ask here for the best way. If this is not the right place to ask this, I would appreciate being pointed to the right place. Thank you.