How to save a mne.viz._mpl_figure.MNELineFigure, such that it remains interactive?

  • MNE version: 1.9.0
  • operating system: Ubuntu 24.04

I am generating an interactive plot (clicking on a curve displays the channel name) with

fig = mne.time_frequency.Spectrum(
        raw,
        method='auto', 
        fmin=0, fmax=np.inf, 
        tmin=None, tmax=None, 
        picks=None, 
        exclude=[], 
        proj=False, 
        remove_dc=False, 
        reject_by_annotation=False, 
        n_jobs=None
).plot()
fig.savefig('myplot.png')

However, as .png, the plot isn’t interactive anymore.
Is there a way/format to keep it interactive?

No! The interactivity comes from Python, so you would have to re-make the figure with Python (MNE, matplotlib, ..).

Mathieu