A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
example: plotly scatter map (#2566)
Akshay Agrawal53afb280ca91
diff --git a/examples/third_party/plotly/scatter_map.py b/examples/third_party/plotly/scatter_map.pynew file mode 100644index 0000000000..53eac0f64e--- /dev/null+++ b/examples/third_party/plotly/scatter_map.py@@ -0,0 +1,52 @@+import marimo++__generated_with = "0.9.4"+app = marimo.App(width="full")+++def __():+ import marimo as mo+ return (mo,)++[email protected](hide_code=True)+def __(mo):+ mo.md(+ r"""+ # Selectable scatter map++ This example shows how to overlay a scatter plot on a map using `Plotly`, and make the plot reactive using [`mo.ui.plotly`](https://docs.marimo.io/guides/plotting.html#plotly) — select plots in the scatter+ plot and get them back in Python!+ """+ )+ return+++def __(mo):+ import plotly.express as px++ df = px.data.carshare()+ fig = mo.ui.plotly(px.scatter_mapbox(+ df,+ lat="centroid_lat",+ lon="centroid_lon",+ color="peak_hour",+ size="car_hours",+ color_continuous_scale=px.colors.cyclical.IceFire,+ size_max=10,+ zoom=10,+ mapbox_style="carto-positron",+ ))+ return df, fig, px+++def __(fig, mo):+ mo.hstack([fig, fig.value], justify="start")+ return+++if __name__ == "__main__":+ app.run()