Tutorial 2: Rich Interactive Outputs¶
MyST renders interactive outputs from Altair, Plotly, and ipywidgets natively. These work both in the static build (pre-rendered from stored outputs) and live via JupyterLite when you run the cell (▶ Run).
Interactive Altair chart¶
Altair charts are fully interactive in the rendered book — no kernel required. Drag to select points in the scatter plot; the bar chart updates in real time.
ipywidgets slider¶
Once you run this cell, the slider is live and interactive.
JupyterLite uses Pyodide (Python in WebAssembly), which requires packages to be
loaded via micropip before importing. The setup cell below handles this — it is
hidden from students but runs automatically when the kernel starts.
Pandas DataFrame output¶
DataFrames render as styled HTML tables in the book:
Labelling outputs for reuse¶
Label a cell to embed its output on another page:
On any other page in the book, embed this output with:
{embed}`fig-horsepower-scatter`Summary¶
Altair charts are interactive in the static build — no kernel needed
ipywidgets need the cell to be run first (▶ Run)
Label outputs with
#| label: fig-nameto reuse them across pages