Skip to content

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.

docs: mo.ui.plotly only supports selecting scatter plots (#2510)

Akshay Agrawal10ba194bbbdd
diff --git a/docs/api/plotting.md b/docs/api/plotting.md
index 7e9bc23bf3..43e3a227c1 100644
--- a/docs/api/plotting.md
+++ b/docs/api/plotting.md
@@ -92,6 +92,14 @@ alt.data_transformers.enable('marimo_csv')
## Reactive plots with Plotly
+```{admonition} mo.ui.plotly only supports scatter plots
+:class: warning
+
+marimo can render any Plotly plot, but [`mo.ui.plotly`](#marimo.ui.plotly) only
+supports reactive selections for scatter plots. If you require other kinds of
+selection, consider using [`mo.ui.altair_chart`](#marimo.ui.altair_chart).
+```
+
```{eval-rst}
.. autofunction:: marimo.ui.plotly
```
diff --git a/docs/guides/plotting.md b/docs/guides/plotting.md
index f9c0fcbd47..c4c2fce645 100644
--- a/docs/guides/plotting.md
+++ b/docs/guides/plotting.md
@@ -23,8 +23,10 @@ available in Python as a Pandas dataframe_!
```{admonition} Requirements
:class: warning
-Reactive plots currently require Altair or Plotly. Install with `pip install altair`
-or `pip install plotly`, depending on which library you are using.
+Reactive plots currently require Altair or Plotly. Install with `pip install
+altair` or `pip install plotly`, depending on which library you are using.
+Selections in plotly are limited to scatter plots, while Altair supports
+a larger class of plots for selections.
```
### Altair
@@ -212,6 +214,15 @@ conda install -c conda-forge "vegafusion-python-embed>=1.4.0" "vegafusion>=1.4.0
### Plotly
+```{admonition} mo.ui.plotly only supports scatter plots
+:class: warning
+
+marimo can render any Plotly plot, but [`mo.ui.plotly`](#marimo.ui.plotly) only
+supports reactive selections for scatter plots. If you require other kinds of
+selection, consider using [`mo.ui.altair_chart`](#marimo.ui.altair_chart).
+```
+
+
```{eval-rst}
.. marimo-embed::
:size: large
diff --git a/marimo/_plugins/ui/_impl/plotly.py b/marimo/_plugins/ui/_impl/plotly.py
index 3660f1f95b..bfeb8edfd5 100644
--- a/marimo/_plugins/ui/_impl/plotly.py
+++ b/marimo/_plugins/ui/_impl/plotly.py
@@ -43,8 +43,10 @@ PlotlySelection = Dict[str, JSONType]
class plotly(UIElement[PlotlySelection, List[Dict[str, Any]]]):
"""Make reactive plots with Plotly.
- Use `mo.ui.plotly` to make plotly plots reactive: select data
- with your cursor on the frontend, get them as a list of dicts in Python!
+ Use `mo.ui.plotly` to make plotly plots reactive: select data with your
+ cursor on the frontend, get them as a list of dicts in Python!
+
+ This function currently only supports scatter plots.
**Example.**