-
Notifications
You must be signed in to change notification settings - Fork 586
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] plotly in nilearn.surface.vol_to_surf opens two interactive windows #4376
Comments
I can reproduce this with the code below on Nilearn 0.10.4 from nilearn import datasets
from nilearn import plotting
import numpy as np
from nilearn import surface
stat_img = datasets.load_sample_motor_activation_image()
fsaverage = datasets.fetch_surf_fsaverage()
curv_right = surface.load_surf_data(fsaverage.curv_right)
curv_right_sign = np.sign(curv_right)
texture = surface.vol_to_surf(stat_img, fsaverage.pial_right)
engine="plotly"
fig = plotting.plot_surf_stat_map(
fsaverage.infl_right, texture, hemi='right',
title='Surface right hemisphere', colorbar=True,
threshold=1., bg_map=curv_right_sign, bg_on_data=True,
engine=engine
)
fig.show() |
no idea if this is the expected behavior or if this is a new thing |
OK, I would not expect this behavior (disclaimer: I rarely use NBs) |
Note that a very basic example like this does not behave like this: import plotly.express as px
fig = px.line(x=["a","b","c"], y=[1,3,2], title="sample figure")
fig.show() |
Not sure why two windows would open, but the issue with a browser opening when calling the nilearn/nilearn/plotting/displays/_figures.py Lines 79 to 90 in 88be15f
vs the typical default of "notebook_connected": https://plotly.com/python/renderers/#setting-the-default-renderer |
Is there an existing issue for this?
Operating system
Operating system version
Python version
nilearn version
0.10.3
Expected behavior
(see below)
Current behavior & error messages
Hi nilearn community,
Thank you very much for this very helpful tool. I am not really sure whether this is really a bug. However, since a warning and a request were stated in the documentation, I thought it might be useful to report the following behavior.
When selecting
engine='plotly'
as a parameter within theplot_surf_roi
function in a JupyterNotebook (see snippet of my code below), an interactive window is open within my JupyterNotebook, but also another in my browser. I would have expected the interactive window to only open within the notebook. However, if this is the expected behavior, please ignore the issue. Other than that, the plotting seemed to work well.best,
lya
Steps and code to reproduce bug
The text was updated successfully, but these errors were encountered: