Get help from the marimo community

Updated 5 months ago

dataframe corresponding to brushed segment of a plotly scatterplot

This is more of a python question, but is there a way to return dataframe corresponding to brushed segment of a plotly scatterplot? Similar to altair.
  • @Mustjaab
M
1 comment
@Mustjaab , you should be able to do something like

Plain Text
import plotly.express as px
import marimo as mo
from vega_datasets import data
import polars as pl # or pandas

_plot = px.scatter(
    data.cars(), x="Horsepower", y="Miles_per_Gallon", color="Origin"
)
plot = mo.ui.plotly(_plot)

# in another cell
df = pl.DataFrame(plot.value)
df
Add a reply
Sign up and join the conversation on Discord