Alternative to stc.plot that does not open a new window

I am using MNE python on a remote server, and every command that opens a new window does not work as that window is not shown on the platform I am using. I want to plot the source estimation using the subjects structural MR image and MNE, through the command stc.plot. Is there another command, that shows the MNE source estimation on the brain, without opening a new window?

This is the code I want to execute (from the mne tools introductory tutorial ‘Overview of MEG/EEG analysis with MNE-Python’):

# path to subjects' MRI files
subjects_dir = sample_data_folder / "subjects"
# plot the STC
stc.plot(initial_time=0.1, hemi="split", views=["lat", "med"], subjects_dir=subjects_dir)

Pyplots from matplotlib work. Is there another way to plot the source estimation on the cortical surface?

  • MNE version: e.g. 1.8.0
  • operating system: Ubuntu 24.04
  • Working from Jupyter Lab 4.2.5 through the platform UCloud (GitHub - SDU-eScience/UCloud)

When typing mne.sys_info(), I get the following:

Platform Linux-5.15.156.el8-x86_64-with-glibc2.39
Python 3.10.14 | packaged by conda-forge | (main, Mar 20 2024, 12:45:18) [GCC 12.3.0]
Executable /work/XXX/virt_env/bin/python
CPU x86_64 (64 cores)
Memory 376.5 GB

Core
├☑ mne 1.8.0 (latest release)
├☑ numpy 2.1.2 (OpenBLAS 0.3.27 with 64 threads)
├☑ scipy 1.14.1
└☑ matplotlib 3.9.2 (backend=inline)

Numerical (optional)
├☑ sklearn 1.5.2
├☑ nibabel 5.3.1
├☑ nilearn 0.10.4
├☑ pandas 2.2.3
├☑ h5io 0.2.4
├☑ h5py 3.12.1
└☐ unavailable numba, dipy, openmeeg, cupy

Visualization (optional)
├☑ pyvista 0.44.1 (OpenGL unavailable)
├☑ pyvistaqt 0.11.1
├☑ vtk 9.3.1
├☑ ipywidgets 8.1.5
└☐ unavailable qtpy, ipympl, pyqtgraph, mne-qt-browser, trame_client, trame_server, trame_vtk, trame_vuetify

Ecosystem (optional)
└☐ unavailable mne-bids, mne-nirs, mne-features, mne-connectivity, mne-icalabel, mne-bids-pipeline, neo, eeglabio, edfio, mffpy, pybv