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
fix: fallback to normal matplotlib when interactive is not supported (#3212)
Myles Scolnicka463739538ad
diff --git a/marimo/_plugins/stateless/mpl/_mpl.py b/marimo/_plugins/stateless/mpl/_mpl.pyindex 2228a9b033..a18bec286b 100644--- a/marimo/_plugins/stateless/mpl/_mpl.py+++ b/marimo/_plugins/stateless/mpl/_mpl.py@@ -18,6 +18,7 @@ import timefrom pathlib import Pathfrom typing import TYPE_CHECKING, Any, Optional, Tuple, Union+from marimo import _loggersfrom marimo._output.builder import hfrom marimo._output.formatting import as_htmlfrom marimo._output.hypertext import Html@@ -29,8 +30,11 @@ from marimo._runtime.context import ()from marimo._runtime.context.kernel_context import KernelRuntimeContextfrom marimo._server.utils import find_free_port+from marimo._utils.platform import is_pyodidefrom marimo._utils.signals import get_signals+LOGGER = _loggers.marimo_logger()+if TYPE_CHECKING:from matplotlib.axes import Axesfrom matplotlib.backends.backend_webagg_core import FigureManagerWebAgg@@ -344,6 +348,14 @@ def interactive(figure: Union[Figure, SubFigure, Axes]) -> Html:- An interactive matplotlib figure as an `Html` object"""+ # We can't support interactive plots in Pyodide+ # since they require a WebSocket connection+ if is_pyodide():+ LOGGER.error(+ "Interactive plots are not supported in Pyodide/WebAssembly"+ )+ return as_html(figure)+# No top-level imports of matplotlib, since it isn't a required# dependencyfrom matplotlib.axes import Axes