pip install nb_thumb
from nb_thumb import nb2thumb
nb2thumb(nb_path='test_nbs/geom_col.ipynb',
label='two_variable_bar_plot',
size=(200,200))
This will show a gallery of plots from notebooks.
from nb_thumb import gallery
:::{.callout-important}
When using nb_thumb.gallery you should always set the Quarto directive #|output: asis so that the markdown is rendered correctly in quarto.
See raw output for more information.
:::
plots = \
[dict(nb_path= 'test_nbs/geom_col.ipynb', label='two_variable_bar_plot'),
dict(nb_path='test_nbs/PlotnineAnimation.ipynb', label='spiral'),
dict(nb_path='test_nbs/geom_density.ipynb', label='density_curve'),
dict(nb_path='test_nbs/geom_map.ipynb', label='map'),
dict(nb_path='test_nbs/geom_segment.ipynb', label='ranges'),
dict(nb_path='test_nbs/geom_segment.ipynb', label='rank')]
::: {.content-visible when-format="markdown"}
#|output: asis
print(gallery(plots))
:::
::: {.content-visible when-format="html"}
#|echo: fenced
#|output: asis
print(gallery(plots))
::: {.content-block .grid .gap-4}
::: {.g-col-6 .g-col-md-6 .mb-4 .border .rounded .shadow-sm .d-flex .flex-column .justify-content-center .align-items-center .px-3}
{.plot-gallery}
[Two Variable Bar Plot](test_nbs/geom_col.ipynb#example)
:::
::: {.g-col-6 .g-col-md-6 .mb-4 .border .rounded .shadow-sm .d-flex .flex-column .justify-content-center .align-items-center .px-3}
{.plot-gallery}
[Spiral](test_nbs/PlotnineAnimation.ipynb#example)
:::
::: {.g-col-6 .g-col-md-6 .mb-4 .border .rounded .shadow-sm .d-flex .flex-column .justify-content-center .align-items-center .px-3}
{.plot-gallery}
[Density Curve](test_nbs/geom_density.ipynb#example)
:::
::: {.g-col-6 .g-col-md-6 .mb-4 .border .rounded .shadow-sm .d-flex .flex-column .justify-content-center .align-items-center .px-3}
{.plot-gallery}
[Map](test_nbs/geom_map.ipynb#example)
:::
::: {.g-col-6 .g-col-md-6 .mb-4 .border .rounded .shadow-sm .d-flex .flex-column .justify-content-center .align-items-center .px-3}
{.plot-gallery}
[Ranges](test_nbs/geom_segment.ipynb#example)
:::
::: {.g-col-6 .g-col-md-6 .mb-4 .border .rounded .shadow-sm .d-flex .flex-column .justify-content-center .align-items-center .px-3}
{.plot-gallery}
[Rank](test_nbs/geom_segment.ipynb#example)
:::
:::
:::
For more information and examples, see the docs.