mpl_interactions: partial compatibility with marimo notebook

Hi,

I have started using Marimo notebooks recently.
I would like to use mpl_interactions and especially the hyperslicer function, but I didn’t manage to force the function to use Matplotlib Sliders instead of ipywidget ones.

As you can see below, the sliders do not appear.

But I know Marimo notebook are compatible with Matplotlib Sliders, thanks to the use of the function mo.mpl.interactive as this example shows:

Is it possible to use Matplotlib Slider for the hyperslicer? If yes how?

Thank you for your help.

Please find the minimal working example code source below:

import marimo as mo

import matplotlib.pyplot as plt
import numpy as np

# to test mpl_interactions
from mpl_interactions import hyperslicer
import requests
import io
from matplotlib.widgets import Slider
import mpl_interactions.ipyplot as iplt

fig, ax = plt.subplots()
plt.subplots_adjust(bottom=.25)
x = np.linspace(0,2*np.pi,200)
def f(x, freq):
    return np.sin(x*freq)
axfreq = plt.axes([0.25, 0.1, 0.65, 0.03])
slider = Slider(axfreq,label='freq', valmin=.05, valmax = 10)
controls = iplt.plot(x,f, freq=slider, use_ipywidgets=False, ax=ax)
mo.mpl.interactive(plt.gcf())

# Get the dataset directly from github
response = requests.get("https://github.com/jrussell25/data-sharing/raw/master/srs_beads.npy")
response.raise_for_status()
beads = np.load(io.BytesIO(response.content))

# Pass vmin and vmax for 8bit images otherwise the linear intensity slider appears useless
fig1, ax1 = plt.subplots()
control1 = hyperslicer(beads, vmin=0, vmax=255, play_buttons=True, play_button_pos="left", 
                       use_ipywidgets=False, 
                       force_ipywidgets=False)
mo.mpl.interactive(plt.gcf())

I have found a workaround that is working but not pretty.
In a new cell, I add mo.mpl.interactive(control1.control_figures[0]) to access directly the control_figures and display them thanks to the Marimo interactive function.