Skip to content

Instantly share code, notes, and snippets.

@gmacario
Created July 28, 2025 11:49
Show Gist options
  • Save gmacario/5527d632126e6aa0d3713efd826a1eb0 to your computer and use it in GitHub Desktop.
Save gmacario/5527d632126e6aa0d3713efd826a1eb0 to your computer and use it in GitHub Desktop.
# Borrowed from https://github.com/marimo-team/marimo/blob/main/docs/guides/working_with_data/plotting.md#altair
@app.cell
async def __():
import pandas as pd
import pyodide
import micropip
import json
await micropip.install('altair')
import altair as alt
return
@app.cell
def __():
cars = pd.DataFrame(json.loads(
pyodide.http.open_url('https://vega.github.io/vega-datasets/data/cars.json').read()
))
chart = mo.ui.altair_chart(alt.Chart(cars).mark_point().encode(
x='Horsepower',
y='Miles_per_Gallon',
color='Origin'
))
return
@app.cell
def __():
mo.vstack([chart, mo.ui.table(chart.value)])
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment