Skip to content
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

mne_connectivity.viz.plot_connectivity_circle: Don't render figure until all axes are created when using the ax argument #253

Open
JohannesWiesner opened this issue Nov 5, 2024 · 3 comments

Comments

@JohannesWiesner
Copy link

Describe the bug

I want to plot multiple connectograms on a single figure. For that I am following the tutorial and call mne_connectivity.viz.plot_connectivity_circle in a for-loop each time passing the respective ax object to the function. I am using Spyder as IDE (not sure if this is the problem). It seems that the function seems to render the full figure at each iteration (?) leading to only the first ax being visible. The others are empty. I can solve this problem by simply calling fig again one more time after the for-loop has finished:

image

After running fig one more time:

image

Steps to reproduce

Execute code from example

Expected results

Don't render figure until all subplots have been populated.

Additional information

mne.sys_info()
Platform Linux-5.15.0-116-generic-x86_64-with-glibc2.35
Python 3.9.20 | packaged by conda-forge | (main, Sep 30 2024, 17:49:10) [GCC 13.3.0]
Executable /zi/home/johannes.wiesner/micromamba/envs/csp_wiesner_johannes/bin/python
CPU x86_64 (32 cores)
Memory 62.7 GB

Core
├☑ mne 1.8.0 (latest release)
├☑ numpy 1.26.4 (OpenBLAS 0.3.27 with 32 threads)
├☑ scipy 1.13.1
└☑ matplotlib 3.7.3 (backend=module://matplotlib_inline.backend_inline)

Numerical (optional)
├☑ sklearn 1.5.2
├☑ numba 0.60.0
├☑ nibabel 5.3.1
├☑ nilearn 0.9.0
├☑ pandas 2.2.2
├☑ h5py 3.12.1
└☐ unavailable dipy, openmeeg, cupy, h5io

Visualization (optional)
├☑ qtpy 2.4.1 (PyQt5=5.15.8)
└☐ unavailable pyvista, pyvistaqt, vtk, ipympl, pyqtgraph, mne-qt-browser, ipywidgets, trame_client, trame_server, trame_vtk, trame_vuetify

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

@JohannesWiesner
Copy link
Author

Ah I see, in the meantime the show argument has been added. So I guess the example has to be updated.

@JohannesWiesner
Copy link
Author

Oops, maybe this should not have been closed

@tsbinns
Copy link
Collaborator

tsbinns commented Nov 11, 2024

My immediate thought is that this is just a plotting backend thing/whether its run in interactive mode or not. Like the the example shows, by the end of the for loop all subplots should be rendered.

If you get different behaviour with your setup you could just set plot=False for each iteration of the for loop, then afterwards call plt.show(). The show parameter has been present ever since the visualisation functions were ported over, so I wouldn't say the example is outdated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants