Created
July 28, 2025 11:49
-
-
Save gmacario/5527d632126e6aa0d3713efd826a1eb0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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