Created
September 18, 2024 11:38
-
-
Save kolibril13/6472a5cac1213330f1c61de347cadb1d to your computer and use it in GitHub Desktop.
flower in marimo
This file contains 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
import marimo | |
__generated_with = "0.8.15" | |
app = marimo.App(width="medium") | |
@app.cell | |
def __(): | |
import marimo as mo | |
import polars as pl | |
import quak | |
return mo, pl, quak | |
@app.cell | |
def __(mo, pl, quak): | |
df_iris = pl.read_csv("https://raw.githubusercontent.com/mwaskom/seaborn-data/master/iris.csv") | |
widget_quack = mo.ui.anywidget(quak.Widget(df_iris)) | |
widget_quack | |
return df_iris, widget_quack | |
@app.cell | |
def __(mo): | |
from tldraw import FlowerPlot | |
flower_data_start = [ | |
{"sepal_length": 5.1, "sepal_width": 3.5, "petal_length": 1.4, "petal_width": 0.4}, | |
{"sepal_length": 4.9, "sepal_width": 3.0, "petal_length": 1.4, "petal_width": 0.2}, | |
] | |
widget_flower = mo.ui.anywidget(FlowerPlot(flower_data=flower_data_start)) | |
widget_flower | |
return FlowerPlot, flower_data_start, widget_flower | |
@app.cell | |
def __(widget_flower, widget_quack): | |
df = widget_quack.data().pl() | |
widget_flower.flower_data = df.select(["sepal_length", "sepal_width", "petal_length", "petal_width"]).to_dicts() | |
return df, | |
@app.cell | |
def __(): | |
return | |
if __name__ == "__main__": | |
app.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment