Skip to content

Commit

Permalink
mpl_interactive -> mpl.interactive
Browse files Browse the repository at this point in the history
  • Loading branch information
akshayka committed Sep 27, 2023
1 parent b96bbd9 commit 42261fa
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 7 deletions.
4 changes: 2 additions & 2 deletions marimo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"image",
"left",
"md",
"mpl_interactive",
"mpl",
"pdf",
"refs",
"right",
Expand All @@ -48,13 +48,13 @@
from marimo._output.justify import center, left, right
from marimo._output.md import md
from marimo._plugins import ui
from marimo._plugins.stateless import mpl
from marimo._plugins.stateless.accordion import accordion
from marimo._plugins.stateless.audio import audio
from marimo._plugins.stateless.callout_output import callout
from marimo._plugins.stateless.download import download
from marimo._plugins.stateless.flex import hstack, vstack
from marimo._plugins.stateless.image import image
from marimo._plugins.stateless.mpl import mpl_interactive
from marimo._plugins.stateless.pdf import pdf
from marimo._plugins.stateless.tabs import tabs
from marimo._plugins.stateless.tree import tree
Expand Down
10 changes: 10 additions & 0 deletions marimo/_plugins/stateless/mpl/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright 2023 Marimo. All rights reserved.
"""Utilities for working with matplotlib."""


__all__ = [
"interactive",
]


from marimo._plugins.stateless.mpl._mpl import interactive
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ def cleanup(self, cell_id: CellId_t) -> None:


@mddoc
def mpl_interactive(figure: "Figure | Axes") -> Html: # type: ignore[name-defined] # noqa:F821,E501
def interactive(figure: "Figure | Axes") -> Html: # type: ignore[name-defined] # noqa:F821,E501
"""Render a matplotlib figure using an interactive viewer.
The interactive viewer allows you to pan and zoom, and see plot coordinates
Expand All @@ -280,7 +280,7 @@ def mpl_interactive(figure: "Figure | Axes") -> Html: # type: ignore[name-defin
```python
fig = plt.figure()
plt.plot([1, 2])
mo.mpl_interactive(fig)
mo.mpl.interactive(fig)
```
**Args**:
Expand Down
2 changes: 1 addition & 1 deletion marimo/_runtime/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import pytest

from marimo._ast.cell import CellId_t
from marimo._plugins.stateless.mpl import InteractiveMplRegistry
from marimo._plugins.stateless.mpl._mpl import InteractiveMplRegistry
from marimo._plugins.ui._core.registry import UIElementRegistry
from marimo._runtime.context import get_context
from marimo._runtime.requests import ExecutionRequest
Expand Down
2 changes: 1 addition & 1 deletion marimo/_runtime/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

if TYPE_CHECKING:
from marimo._messaging.streams import Stderr, Stdout, Stream
from marimo._plugins.stateless.mpl import InteractiveMplRegistry
from marimo._plugins.stateless.mpl._mpl import InteractiveMplRegistry
from marimo._plugins.ui._core.registry import UIElementRegistry
from marimo._runtime.runtime import Kernel

Expand Down
2 changes: 1 addition & 1 deletion marimo/_runtime/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
)
from marimo._messaging.streams import Stderr, Stdout, Stream, redirect_streams
from marimo._output.rich_help import mddoc
from marimo._plugins.stateless.mpl import InteractiveMplRegistry
from marimo._plugins.stateless.mpl._mpl import InteractiveMplRegistry
from marimo._plugins.ui._core.registry import UIElementRegistry
from marimo._plugins.ui._core.ui_element import MarimoConvertValueException
from marimo._runtime import cell_runner, dataflow
Expand Down
8 changes: 8 additions & 0 deletions marimo/_smoke_tests/iplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ def __():
return mo, np, plt


app._unparsable_cell(
r"""
mo.mpl.
""",
name="__"
)


@app.cell
def __(mo, np, plt):
def interactive_plot(seed = 42, size=100):
Expand Down

0 comments on commit 42261fa

Please sign in to comment.