surfplot icon indicating copy to clipboard operation
surfplot copied to clipboard

Code cannot stop running after closing the interactive window

Open RicardoRyn opened this issue 1 year ago • 4 comments

After I use show(), an interactive window pops up, which is exactly what I want. However, after I manually close this window, the code continues running.

There is my code:

from neuromaps.datasets import fetch_fslr
from surfplot import Plot
from brainspace.plotting.base import Plotter


surfaces = fetch_fslr(data_dir=r"E:\vscode\git_repositories\Plot_figure\neuromaps-data")
lh, rh = surfaces['veryinflated']
p = Plot(lh, rh)
p.show(embed_nb=False, interactive=True, transparent_bg=False, scale=(1,1))

Uploading bb7173c8b6a394298d926c61fd9856f.png…

I can only terminate it by restarting my Jupyter notebook, which is quite annoying. (`へ´)

RicardoRyn avatar Jan 10 '25 02:01 RicardoRyn

by the way:

python 3.11.9
surfplot==0.2.0
pyvista==0.43.3

RicardoRyn avatar Jan 10 '25 02:01 RicardoRyn

Thanks for opening this issue! This is pretty bizarre, does it happen when you set interactive=False?

danjgale avatar Jan 11 '25 23:01 danjgale

when I set interactive=False and not change anything else, the popuped windows cannot interactive (it just a static picture). And when I colse the window, the code still hasn't terminated. And I must restart my Jupyter notebook.

RicardoRyn avatar Jan 13 '25 06:01 RicardoRyn

I can re-create this issue, I'll have to dig deeper into the cause of it and it could be a Brainspace-related/vtk issue. Thanks for raising this.

Surfplot isn't really intended to provide an interactive viewer, but rather to create a high-quality surface plot in matplolib for publication. If full interactivity is desired, I'd recommend using Connectome Workbench. Once you know the views you wish to visualize the data, you can always use surfplot and adjust the views argument. Perhaps at some point interactivity can be improved.

In terms of static plotting, the options are a) use the p.build() to generate a static matplotlib figure, or b) switch the embed_nb=True if your use-case requires the use of p.show().

danjgale avatar Jan 27 '25 18:01 danjgale