Simple plots using JupyterLite + pyodide-kernel

In this example, we connect to a pyodide kernel using wrapper classes and in-browser Jupyter server the from the jupyterlite project.

Thebe code that uses jupyterlite has been bindles separately in the thebe-lite library, which should be side-loaded on the page prior to thebe being loaded. thebe-lite is not a standalone library but when thebe is bootstrapped with the useJupyterLite option set, it will detect and use thebe-lite or throw an error.

%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt

plt.ion()
fig, ax = plt.subplots()
ax.scatter(*np.random.randn(2, 100), c=np.random.randn(100))
ax.set(title="Wow, an interactive plot!")