# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# # Pandas template
#
# * Cells before the `# [[nbplot]] template` are ignored.
# * Cells starting with `# [[nbplot]] ignore` are also ignored.
#
# * Some variables are substituted in every cell:
#     * `${root_path}`: the working directory when `nbplot` was called. Input files will be relative to this.
#
# * Some variables are subtituted in the `[[nbplot]] for i,input in enumerate(inputs)` blocks:
#     * `${i}`: index of the input in the list
#     * `${input.pretty_name}`: truncated path of the file, or 'stdin'
#     * `${input.rel_path}`: path of the file relative to the `root_path`, or `stdin`
#     * `${input.abs_path_or_io}`: full filepath or StringIO when the data comes from stdin
#     * `${input.guessed_sep}`: separator guessed by nbplot for this file. Usually space or comma.

# +
# [[nbplot]] template
# Note: don't change that first line, it tells nbplot that the notebook below is a template
# This cell will be executed and the metadata dictionary loaded, but not included in the output.

template_metadata = {
    'name': 'imshow',
    'format_version': '0.1'
}

# +
import io, math, os, sys
from base64 import b64decode
from pathlib import Path

import matplotlib.pyplot as plt
import numpy as np
import mplcursors

import PIL

# +
root_path = Path("$root_path")

# [[nbplot]] for i,input in enumerate(inputs)
name${i} = "${input.pretty_name}"; file_or_io${i} = ${input.abs_path_or_io}
im${i} = PIL.Image.open(file_or_io${i})
display(im${i}.format, im${i}.size, im${i}.mode)
fig,ax = plt.subplots(figsize=(16,im${i}.size[1]*16/im${i}.size[0]))
ax.set_title(name${i})
ax.imshow(im${i});
# [[nbplot]] endfor

StarcoderdataJupyterScriptsDedupFiltered