Interactive matplotlib plot shows only a part of a plot

Hello,

I’m trying to create an interactive (matplotlib) plot in Panel. Here’s a simple example. Works fine when interactive is set to False, but only shows a quarter of a plot when interactive is set to True. Can’t make it show the whole plot, only the top left corner.

import numpy as np
import panel as pn
import matplotlib.pyplot as plt

pn.extension('ipywidgets')

fig, ax = plt.subplots(1,1,figsize=(10,6), layout='tight')

x1 = np.linspace(0,2*np.pi,50)
y1 = np.sin(x1)

ax.plot(x1,y1)

my_text = pn.widgets.StaticText(name='Some text here', value='')
my_plot = pn.pane.Matplotlib(fig, tight=True, interactive=True)

pn.template.MaterialTemplate(
    site="Panel",
    title="Interactive Plot",
    sidebar=[my_text],
    main=[my_plot],
).servable();

I’m using:

bokeh 3.6.3
holoviews 1.20.0
ipykernel 6.29.5
ipyleaflet 0.19.2
ipympl 0.9.6
ipython 8.32.0
ipywidgets 8.1.5
ipywidgets_bokeh 1.6.0
jupyter 1.1.1
jupyter_client 8.6.3
jupyter-console 6.6.3
jupyter_core 5.7.2
jupyter_server 2.15.0
jupyter_server_terminals 0.5.3
jupyterlab 4.4.0b1
jupyterlab_server 2.27.3
jupyterlab_widgets 3.0.13
matplotlib 3.10.0
matplotlib-inline 0.1.7
panel 1.6.1

Decided to use Bokeh backend instead of matplotlib which has been a bit more successful. Can leave the item open as it may be a bug.

I do have the same problem when using interactive=True in the Matplotlib pane. Did someone manage to fix the problem?